2011-01-28 181 views
0

我一直在尝试将WCF服务部署到IIS 5.1。我在这里找到了this的答案 - 这似乎是同一个问题;然而,我遵循这个时候,然后尝试浏览到服务页面,我得到以下错误:在IIS 5.1上部署WCF服务

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... 

我在IIS中创建一个虚拟目录,并指着我的解​​决方案文件夹中的子目录 - 和我正在发布到虚拟目录。

我的web.config文件服务节点看起来是这样的:

<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> 

这编译和VS2008的时候运行下运行正常。任何人都可以向我指出正确的方向吗?

回答

1

我终于找到了答案。 IIS下的应用程序被配置为使用ASP.NET 1.1。我将其更改为2.0,并且运行良好。

0

路径背后的代码看起来不正确,我认为它应该是一个相对路径,以便:

代码隐藏=“〜/ App_Code文件/ YourServiceClass.cs”

+0

没有App_Code目录,但用〜/ MyService.svc.cs替换MyService.svc.cs没有任何区别 – 2011-01-28 13:32:40

0

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

+0

MyService.svc背后的代码是MyService.svc.cs - 因此它是有效的。 – 2011-01-28 14:06:27