Server Error in Application - when trying to access WCF Service
I have a WCF service that I would like to host in IIS 7.5. My setup: The physical path of the folder with .svc file is: C:\inetpub\wwwroot\SmartSolution\Services\Services\ContainerManagementService.svc My binaries are in C:\inetpub\wwwroot\SmartSolution\Services\bin and I also copied them to C:\inetpub\wwwroot\SmartSolution\Services\Services\bin
I have created a web application in IIS for both Services folders.
Here is the config file for the WCF endpoint:
<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 includeExce开发者_开发问答ptionDetailInFaults="false" />
</behavior>
</behaviors>
Here is my .svc file makrkup:
<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.ContainerManagementService" CodeBehind="ContainerManagementService.svc.cs" %>
When I try to navigate to: http://localhost/SmartSolution/Services/Services/ContainerManagementService.svc , the following error is displayed:
Server Error in '/SMARTSOLUTION/Services/Services' Application. [ServiceActivationException: The service '/SMARTSOLUTION/Services/Services/ContainerManagementService.svc' cannot be activated due to an exception during compilation. The exception message is: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1).] is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
How can I get the service to work. Thanks!
Looking at the exceptions, it seems that your assemblies (in bin folder) are built targeting x64 Plaform and they're now either deployed on 32bit machine or application pool configured for application is running under 32bit mode (Enable 32 bit Applications = "true"). Thus, process is unable to load the assemblies built for x64 platform and fails with exception.
HTH Amit
精彩评论