2011-03-29 99 views
0

我有一個WCF服務,我想在IIS 7.5中託管。我的設置: 帶有.svc文件的文件夾的物理路徑是:C:\ inetpub \ wwwroot \ SmartSolution \ Services \ Services \ ContainerManagementService.svc 我的二進制文件位於C:\ inetpub \ wwwroot \ SmartSolution \ Services \ bin和我也將它們複製到 C:\ inetpub \ wwwroot \ SmartSolution \ Services \ Services \ bin應用程序中的服務器錯誤 - 嘗試訪問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,將顯示以下錯誤:

服務器錯誤 '/ SMARTSOLUTION/Services/Services' 應用程序。 [ServiceActivationException: 服務 '/SMARTSOLUTION/Services/Services/ContainerManagementService.svc' 無法在編譯期間由於 異常而被激活。 異常信息是:不是有效的 Win32應用程序。 (例外從 HRESULT:0x800700C1)。]不是有效的 Win32應用程序。 (例外從 HRESULT:0x800700C1)

我怎樣才能讓服務工作。謝謝!

回答

4

看看例外情況,看起來您的程序集(在bin文件夾中)是針對x64 Plaform構建的,現在它們既可以部署在32位機器上,也可以配置爲應用程序池,以便應用程序在32位模式下運行(啓用32位應用程序=「true」)。因此,進程無法加載爲x64平臺構建的程序集,並因異常而失敗。

HTH 阿米特

+2

實際修復是這樣的:1.內IIS(7)單擊應用程序池。 2.在列表中找到爲您的Web應用程序配置的應用程序池。 3.選擇它,然後單擊右側的高級設置。 4.列表中的第二項設置:啓用32位應用程序 - 必須設置爲True。 – laconicdev 2011-03-29 19:39:43

+0

非常感謝您的評論 – 2014-09-30 11:53:14

相關問題