In Win8, the WCF "cocould not load type 'System. servicemodel. Activation. httpmodule '"

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.