Could not load type 'System.ServiceModel.Activation.HttpModule'

前端 未结 8 1450
不思量自难忘°
不思量自难忘° 2020-12-28 19:32

I am run aspnet_regiis.exe, still I am getting same error:

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.Ser

相关标签:
8条回答
  • 2020-12-28 20:09

    I got the same error after upgrading the IIS server to .NET 4.5.1 (previously .NET 4.0 was installed). In my case, running aspnet_regiis with the parameter -iru fixed the problem, ie.

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -iru
    

    Note: on a 64bit system you should use

    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -iru
    

    Notes:

    • .NET 4.0 and higher (e.g. 4.5.1) all installs into v.4.0.30319, this has changed compared to earlier versions (you will not find a v4.5 folder). To get the installed .NET framework versions, see this answer.

    • The cause of this error is described here, If you want to check manually, I cite the following from this article:

    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 should be defined as follows (notice the preCondition):

    <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

    0 讨论(0)
  • 2020-12-28 20:13

    If you are running Windows 8, this method will not work. Microsoft will not let you to run this command, telling you this:

    This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool.

    The reasons for this are on this link: http://support.microsoft.com/kb/2736284 .

    The solution that worked for me is posted on this link, on the answer by Neha: System.ServiceModel.Activation.HttpModule error

    Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.

    Though this is a valid solution (as explained beautifully here)

    but it did not work with Windows 8.

    For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".

    Thanks Neha

    0 讨论(0)
  • 2020-12-28 20:16

    It seems like the ASP.NET 4.0 is not properly registered with IIS. Could you please try re-registering asp.net with IIS ? You could try for both 2.0 and 4.0 just to make sure it is done for all the .NET versions.

    Use the following commands for both version of asp.net to register asp.net with IIS

    aspnet_regiis -i

    This is located in both .NET framework version folders.

    C:\Windows\Microsoft.NET\Framework\v4.0.30319 and C:\Windows\Microsoft.NET\Framework\v2.0.50727

    0 讨论(0)
  • 2020-12-28 20:16

    I am late, hope it will help someone ....This is a known issue with IIS 8.0

    The solution is to delete the 3.x module and handler from IIS manager. You could delete them at the application or site level if you want to keep them in applicationHost.config. But I wanted to delete them from applicationHost.config. do the following steps:

    In IIS manager, click the machine name node. In “Features View”, double-click “Modules”. Find “ServiceModel” and remove it. Image 1 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’

    Go back to the machine name node’s “Features View”, double-click “Handler Mappings”. Find “svc-Integrated” and remove it. Image 2 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’

    0 讨论(0)
  • 2020-12-28 20:19

    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)
    0 讨论(0)
  • 2020-12-28 20:19

    To resolve this issue, run the following command line:

    1. Close the Application
    2. in the project file(Web Application) change the virtual directory
    3. Now OPEN the Project file

    It will work definitely.

    0 讨论(0)
提交回复
热议问题