2011-03-29 87 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