0

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 ?

Szymson
  • 990
  • 1
  • 13
  • 28

1 Answers1

1

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

Wicher Visser
  • 1,513
  • 12
  • 21
  • Can you please check if you actually have multiple installs of the .NET Framework on that box? – Wicher Visser Feb 24 '16 at 08:47
  • You can also try the second answer in this SO post http://stackoverflow.com/questions/15688930/could-not-load-type-system-servicemodel-activation-httpmodule-from-assembly-s – Wicher Visser Feb 24 '16 at 08:48
  • Wicher Visser how can I check this ? – Szymson Feb 24 '16 at 09:41
  • @Szymson have a look on https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx – Wicher Visser Feb 24 '16 at 09:49
  • In regedit the DWORD value is 394254 so I have installed .NET Framework 4.6.1 on Windows 10. By command prompt Versions installed on the machine v2.0.50727 – Szymson Feb 24 '16 at 10:18
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/104389/discussion-between-szymson-and-wicher-visser). – Szymson Feb 24 '16 at 10:24