After Installing a .NET Framework 4.0. If you decided to
- Install an earlier version of the .NET Framework,
- Or enable .NET 3.0 WCF HTTP Activation.
You might get the following error message
Could not load type ‘System.ServiceModel.Activation.HttpModule’
When you tried to brows a web applications that has been hosted on Internet Information Services (IIS)
Cause :
This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has the following section defined,
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
Where this section is incompatible with the .NET Framework 4.0.
Solution:
- Go to Applicationhost.config file that located in %windir%\system32\inetsrv\config
- Open Applicationhost.config for edit and search for ServiceModel
- Replace the following Tag
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
- By the following tag
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />
- Save the file.
- Go back to browse your site that should be now working properly.
Second Solution
- Go to Start Menu > Run > cmd.
- Type the following command
cd %windir%\Microsoft.NET\Framework\v4.0.30319 -->> aspnet_regiis.exe /iru
This also should be solve the issue.
Enjoy 🙂