【问题标题】:Hosting WCF on IIS在 IIS 上托管 WCF
【发布时间】:2016-06-06 10:25:00
【问题描述】:

我在IIS 上托管WCF Application 服务时遇到问题。该服务正在与Add Service Reference 的其他项目一起在解决方案中工作,但是当我想在IIS 上托管它时,当我从IIS 打开Service.svc 时出现错误。

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 

我的网站配置

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name ="svcbh">
          <serviceMetadata httpGetEnabled="False"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="WCFApplication.Service1" behaviorConfiguration="svcbh">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:9000/Service1/"/>
          </baseAddresses>
        </host>
        <endpoint name="duplexendpoint"
                  address=""
                  binding="wsDualHttpBinding"
                  contract="WCFApplication.IService1"/>
        <endpoint name="MetaDataTcpEndpoint"
                  address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

可能是什么问题?

【问题讨论】:

  • 您是否在服务器上激活了 WCF 功能?
  • 您是否也检查了 HTTP 激活?见this answer

标签: c# wcf iis hosting


【解决方案1】:

可能是您在服务器上安装了多个版本的 .NET Framework。见https://msdn.microsoft.com/en-us/library/hh169179(v=nav.90).aspxhttps://support.microsoft.com/en-us/kb/2015129

【讨论】:

猜你喜欢
  • 2013-10-01
  • 1970-01-01
  • 2012-07-06
  • 1970-01-01
  • 2015-05-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多