If you install DotNet framework 4.0 on Windows Server 2008 or R2 after enabling IIS, you might see following error when browse your application site made of ASP.NET 4.0 (or run on ASP.NET 4.0 application pool).
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’.
Cause & Solution
If IIS is enabled after DotNet 4 installation then ASP.NET is not registered with IIS. You will see the error if your site is targeting ASP.NET 4. To resolve this issue, run the following from elevated command line to register ASP.NET 4:
aspnet_regiis.exe /iru
The aspnet_regiis.exe file can be found in either
- %windir%Microsoft.NETFrameworkv4.0.30319
- %windir%Microsoft.NETFramework64v4.0.30319 (on a 64-bit machine)
More info for ASP.NET IIS Registration Tool (Aspnet_regiis.exe) can be found at http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx
thanks, that helped
wonderful!! Problem solved in 30 seconds 🙂 thank you very much sir!
Thanks,Great
It did a great job.
Thanks…
Thanks, this saved me a good bit of time.
Awseome! Fixed in no time! Much appreciated!
Excellent fix, thanks for the post! Server started and LNLB started reporting ‘The Server’ was alive again.
Thanks
thanks!
This fix won’t work on Windows 8 since aspnet_regiis.exe won’t run on it. For a solution that works with Windows 8, see: my blog post on this error.
Using aspnet_regiis -iru would also work.
Many, many thanks. The .NET being different for 32-bit and 64-bit catches me every time.
May the world praise your name until the sun itself envelopes the earth with a final fiery embrace. Thank you!!! You saved my Win7 install.
thanks. It helped me.
Awesome!!! Had I looked a bit earlier I would have had more hair…
very very thanks
This is what i get on a Windows 10 / IIS8 machine when i tried to run “aspnet_regiis.exe /iru”. Of course, adding ASP.NET 4.7 in IIS didnt solve the initial problem.
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Start installing ASP.NET (4.0.30319.0).
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. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
Finished installing ASP.NET (4.0.30319.0).