[Fix] - Error message after you install the .NET Framework 4.0 Could not load type System.ServiceModel.Activation.HttpModule

Wikitechy | 725 Views | visual studio | 07 Jun 2016

 


Scenario :

  • When I try to run a web application in visual studio the page could Not Load Type and the following error will occur

        ‘System.ServiceModel.Activation.HttpModule’.

  • And also If we try to run a service in the web application and receive a messages over the HTTP transport by receiving an error similar to the following:
Server Error in '/WCFApplication' Application 
Could not load type 
'System.ServiceModel.Activation.HttpModule' from assembly 
'System.ServiceModel, Version=3.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089'.

  • An unhandled exception occurs during the execution of the current Web request
  • And review the stack trace for more information about the error and check whether is originated in the code. 
Exception Details: System.TypeLoadException: 
Could not load type 
'System.ServiceModel.Activation.HttpModule' from assembly 
'System.ServiceModel, Version=3.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089'.

Error :

Error message after you install the .NET Framework 4.0: "Could not load type 'System.ServiceModel.Activation.HttpModule'"

Reason :

  • Generally, this issue will occur because the Applicationhost.config file for Windows Process Activation Service (WAS) was incompatible for .NET Framework 4.0
<add name="ServiceModel" 
type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, 
Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
preCondition="managedHandler" />

And define” precondition” like this way:

<add name="ServiceModel" 
type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, 
Version=3.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" 
preCondition="managedHandler,runtimeVersionv2.0" />


Note :
  •  We can find the Applicationhost.config file using the following location:

        %windir%\system32\inetsrv\config

Fix :

  • Here we can resolve this issue by run the following command:

aspnet_regiis.exe /iru

  • The Aspnet_regiis.exe file can be found in one of the following locations:
  • %windir%\Microsoft.NET\Framework\v4.0.30319
  • %windir%\Microsoft.NET\Framework64\v4.0.30319 (on a 64-bit computer)

Applies to :

  • Windows Workflow Foundation
  • Windows Communication Foundation
  • Microsoft .NET Framework 4

Related Tags :

  • Error message after you install the .NET Framework 4.0
  • Could not load type 'System.ServiceModel.Activation.HttpModule' 
  • asp.net - Could not load type 'System.ServiceModel.Activation
  • Could not load type System.ServiceModel.Activation.HttpModule
  • Could not load type System.ServiceModel.Activation.HttpModule
  • Could not load type 'System.ServiceModel.Activation.HttpModule' from



Workshop

Bug Bounty
IOT Hackathon
Webinar

Join our Community

Advertise