WCF Service hosted in VS Dev server works, in IIS not so much
I have a WCF Service that works just fine in the VS development server, but if I go to project settings and change the Web tab servers to use Local IIS Web Server instead I get a BadImageFormatException. I know that this is typically caused when a 32bit app references a 64bit dll. All of my assemblies are built for AnyCPU.
I don't really know what information would be helpful here, so please post a comment and I'll edit the question as needed.
For starters I'll say that I am using Autofac WCF integration (which again, this works in VS Dev server not IIS). I should also add that I checked IIS settings. Configured for DefaultAppPool which is set to .NET 4 Integrated pipeline. Anonymous authentication enabled, Windows disabled.
Here is a sample of my config file.
<system.serviceModel>
<ser开发者_如何学CviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="Binding_basicHttp">
<readerQuotas maxDepth="1000000000" maxStringContentLength="1000000000" maxArrayLength="1000000000" maxBytesPerRead="1000000000" maxNameTableCharCount="1000000000"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior_MetaAndDebug" name="Service1">
<endpoint binding="basicHttpBinding" name="Service1Endpoint_basicHttp" contract="IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="/mex" binding="mexHttpBinding" bindingConfiguration="" name="Service1Endpoint_mex" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost/Site/Service1/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior_MetaAndDebug">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Figured it out. Nothing wrong in config file, it was the fact that I am running Windows 7 x64 .
http://www.fishofprey.com/2009/04/badimageformatexception-in-iis-70-on-64.html
http://blogs.msdn.com/b/rakkimk/archive/2007/11/03/iis7-running-32-bit-and-64-bit-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx
精彩评论