Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在IIS 5.1上部署WCF服务_C#_Visual Studio 2008_Wcf - Fatal编程技术网

C# 在IIS 5.1上部署WCF服务

C# 在IIS 5.1上部署WCF服务,c#,visual-studio-2008,wcf,C#,Visual Studio 2008,Wcf,我一直在尝试将WCF服务部署到IIS 5.1。我在这里找到了答案——这似乎是同一个问题;但是,当我遵循此操作,然后尝试浏览到服务页面时,会出现以下错误: A name was started with an invalid character. Error processing resource 'http://MyComputerName/MyService/MyService... <%@ ServiceHost Language="C#" Debug="true" Servic

我一直在尝试将WCF服务部署到IIS 5.1。我在这里找到了答案——这似乎是同一个问题;但是,当我遵循此操作,然后尝试浏览到服务页面时,会出现以下错误:

   A name was started with an invalid character. Error processing resource 'http://MyComputerName/MyService/MyService...
<%@ ServiceHost Language="C#" Debug="true" Service="ServiceNamespace.MyService" CodeBehind="MyService.sv...
名称以无效字符开头。处理资源“”时出错http://MyComputerName/MyService/MyService...

代码隐藏路径看起来不正确,我认为它应该是一个相对路径,因此:


CodeBehind=“~/App\u Code/YourServiceClass.cs”

检查您的代码隐藏文件是否指向cs文件,它看起来像是指向svc文件。

我终于找到了答案。IIS下的应用程序配置为使用ASP.NET 1.1。我把它改成了2.0,效果很好。

没有App_代码目录,但是用~/MyService.svc.cs替换MyService.svc.cs没有任何区别MyService.svc的代码是MyService.svc.cs,因此它是有效的。
    <services>
        <service name="ServiceNamespace.MyService" behaviorConfiguration="ServiceNamespace.MyService">
            <!-- Service Endpoints -->
            <endpoint address="" binding="basicHttpBinding" contract=" ServiceNamespace.IMyService">
                <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.          
                <identity>
                    <dns value="localhost"/>
                </identity>
      -->
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>