【问题标题】:WCF Service hosted in VS Dev server works, in IIS not so much托管在 VS 开发服务器中的 WCF 服务有效,而在 IIS 中则没有那么多
【发布时间】:2011-03-19 00:33:48
【问题描述】:

我有一个在 VS 开发服务器中运行良好的 WCF 服务,但是如果我转到项目设置并将 Web 选项卡服务器更改为使用本地 IIS Web 服务器,我会得到一个 BadImageFormatException。我知道这通常是在 32 位应用程序引用 64 位 dll 时引起的。我所有的程序集都是为 AnyCPU 构建的。

我真的不知道什么信息在这里会有所帮助,所以请发表评论,我会根据需要编辑问题。

对于初学者,我会说我正在使用 Autofac WCF 集成(这同样适用于 VS 开发服务器而不是 IIS)。我还应该补充一点,我检查了 IIS 设置。为设置为 .NET 4 集成管道的 DefaultAppPool 配置。启用匿名身份验证,禁用 Windows。

这是我的配置文件的示例。

<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>

【问题讨论】:

  • 您是否引用了外部程序集,例如像“SQLite”之类的东西,可能依赖于 32 位/64 位??
  • @marc_s 我引用了一些我编写的外部程序集,它们是使用 AnyCPU 构建的。

标签: wcf iis-7 .net-4.0 wcf-configuration


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2020-04-26
  • 1970-01-01
  • 2014-08-23
  • 2022-12-13
  • 1970-01-01
  • 2016-11-19
  • 2012-08-18
相关资源
最近更新 更多