简体   繁体   中英

Hosting WCF on IIS

I have problem with hosting WCF Application service on IIS . The service is working inside solution with other project by Add Service Reference , but when i want host it on IIS I get error when I open Service.svc from IIS .

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

My Web.config

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

What can be the problem ?

It could be that you have multiple versions of the .NET Framework installed on the server. See https://msdn.microsoft.com/en-us/library/hh169179(v=nav.90).aspx and https://support.microsoft.com/en-us/kb/2015129

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM