Reputation: 3777
I am run aspnet_regiis.exe, still I am getting same error:
Could 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: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.
Upvotes: 15
Views: 35965
Reputation: 3221
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’
Upvotes: 1
Reputation: 27001
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
Upvotes: 16
Reputation: 1
On Windows 2012, the following worked :
For a reason I don't know the default application pool was set up to use 4.0 :
but it was not correctly reflected in c:\windows\system32\inetesrv\config\applicationhost.config :
<add name="DefaultAppPool" enable32BitAppOnWin64="true" />
I had to set it back to 2.0 and then to 4.0 again, and then the config file was fine and the error disapeared :
<add name="DefaultAppPool" enable32BitAppOnWin64="true" managedRuntimeVersion="v4.0" />
Upvotes: 0
Reputation: 425
Get to the applicationhost.config file in the following directory: C:\Windows\system32\inetsrv\config
The following section will be defined:
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
The above definition is incompatible with the .NET framework 4.0, you can get this issue resolved by replacing the above section by the following:
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />
Upvotes: 2
Reputation: 9
To resolve this issue, run the following command line:
It will work definitely.
Upvotes: 0
Reputation: 1
To resolve this issue, run the following command line:
Upvotes: 0
Reputation: 1289
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
Upvotes: 21
Reputation: 165
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
Upvotes: 2