2011-03-29 77 views
0

我有一个WCF服务,我想在IIS 7.5中托管。我的设置: 带有.svc文件的文件夹的物理路径为:C:\ inetpub \ wwwroot \ SmartSolution \ Services \ Services \ ContainerManagementService.svc 我的二进制文件位于C:\ inetpub \ wwwroot \ SmartSolution \ Services \ bin在IIS 7.5中托管WCF服务的错误

我已经在IIS中为两个Services文件夹创建了一个Web应用程序。

下面是WCF端点配置文件:

 <service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior" 
    name="MyNamespace.ContainerManagementService"> 
    <endpoint address="" binding="basicHttpBinding" 
     name="ContainerManagementbasicHttpEndpoint" contract="MyNamespace.IContainer"/>     
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service>  
    <behaviors>  
    <behavior name="MyNamespace.ContainerManagementServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
    </behavior> 
</behaviors> 

这里是我的.svc文件makrkup:

<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.ContainerManagementService" CodeBehind="ContainerManagementService.svc.cs" %> 

当我尝试导航到:http://localhost/SmartSolution/Services/Services/ContainerManagementService.svc,将显示以下错误:

类型'MyNamespace.ContainerManagementService',作为ServiceHo中的Service属性值提供st指令无法找到。

如何才能使服务工作。谢谢!

回答

0

IIS期待您的bin文件夹与.svc文件位于同一文件夹中,但似乎将它放在父文件夹中。

另外,您应该只需要在IIS中指定的一个应用程序。

0

如果您的网站在bin文件夹预编译并且已经有二进制文件(含MyNamespace.ContainerManagementService)你不需要指定CodeBehind属性:如果在另一方面你的网站是

<%@ ServiceHost 
    Language="C#"  
    Debug="true" 
    Service="MyNamespace.ContainerManagementService" 
%> 

没有预编译,并且您已经发布了源代码,并且此源代码需要位于特殊的~/App_Code文件夹中。

+0

Darin,我的网站是预编译的。但是,即使在删除CodeBehind属性后,我仍然收到相同的错误。 – laconicdev 2011-03-29 18:03:44