Il servizio WCF ospitato nel server VS Dev funziona, in IIS non tanto
-
27-10-2019 - |
Domanda
Ho un servizio WCF che funziona perfettamente nel server di sviluppo VS, ma se vado alle impostazioni del progetto e modifico i server della scheda Web per utilizzare il server Web IIS locale, ottengo invece un'eccezione BadImageFormatException.So che questo è in genere causato quando un'app a 32 bit fa riferimento a una dll a 64 bit.Tutti i miei assembly sono costruiti per AnyCPU.
Non so esattamente quali informazioni potrebbero essere utili qui, quindi pubblica un commento e modifico la domanda secondo necessità.
Per i principianti, dirò che sto usando l'integrazione Autofac WCF (che ancora una volta funziona in VS Dev server non IIS).Dovrei anche aggiungere che ho controllato le impostazioni di IIS.Configurato per DefaultAppPool che è impostato su .NET 4 Integrated pipeline.Autenticazione anonima abilitata, Windows disabilitato.
Ecco un esempio del mio file di configurazione.
<system.serviceModel>
<serviceHostingEnvironment 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>
Soluzione
Capito.Niente di sbagliato nel file di configurazione, era il fatto che sto eseguendo Windows 7 x64.
http://www.fishofprey.com / 2009/04 / badimageformatexception-in-iis-70-on-64.html