From: http://support.microsoft.com/kb/2015129
Symptoms
Consider the following scenario. you install. net Framework 4.0. then, you install an earlier version of. net Framework, or you enable. net 3.0 wcf http activation. in this scenario, you may receive the following error message when you when run applications that are hosted on Internet Information Services (IIS ):
Cocould not load type 'System. servicemodel. Activation. httpmodule 'from assembly 'System. servicemodel, version = 3.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089 '.
Description: An unhandled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception details: system. typeloadexception: cocould not load type 'System. servicemodel. Activation. httpmodule 'from assembly 'System. servicemodel, version = 3.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089 '.
Cause
This issue occurs because the applicationhost. config file for Windows Process activation Service (was) has the following section defined, and this section is incompatible with the. 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 "/>
This section shoshould be defined as follows:
<Add name = "servicemodel" type = "system. servicemodel. activation. httpmodule, system. servicemodel, version = 3.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089 "precondition =" managedhandler, runtimeversionv2.0 "/>
Note You can find the applicationhost. config file in the following location:
% Windir % \ system32 \ inetsrv \ config
Resolution
To resolve this issue, run the following command line:
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)
Note:
The above scheme is invalid in the Win8 system, because the aspnet_regiis.exe/IRU command will fail in the last step, so the solution is to find the applicationhost. config file (the directory is% Windir % \ system32 \ inetsrv \ config), And then put the following in the file:
<Add name = "servicemodel" type = "system. servicemodel. activation. httpmodule, system. servicemodel, version = 3.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089 "precondition =" managedhandler "/>
Changed:
<Add name = "servicemodel" type = "system. servicemodel. Activation. httpmodule, system. servicemodel, version = 3.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089" precondition = "managedhandler, Runtimeversionv2.0"/>
I currently only find this solution. If there is a better solution, please note.