So, day before yesterday I was working on some app. And I deployed it on my IIS (v7.5) server. The deployment process went very well without any sort of troubles. But when I tried to run that application from my web browser I got loads of error. And I found that the main error was something like this,
Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’
Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
Description: An unhandled exception occurred during the execution of the current Web request. 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=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
With little googling, I found that I was not the first victim of this error !!! And after few clicks I finally found the reason and solution for this error.
The Reason: If you have installed IIS AFTER installing .NET Framework 4 (in my case) then it won’t get register with IIS and so when you run the app that is built on .NET v.4 by deploying it won’t work and will give you above mentioned error. And the solution is next.
The Solution: The solution for this error is to run “Aspnet_regiis.exe” utility stored at “C:\Windows\Microsoft.NET\Framework64\v4.0.30319” (in my case, but it should be different if you are on x86 machine), and use “-iru“ parameter with it and run it. It will install ASP.NET and you are all set (this is what happened in my case).
I have included my screenshot for look.
(I know that there has been loads of posts / blogs about this same issue and I am just adding one, because this blog is like general note for my reference. Which I use as reference time to time.)
That’s it for now. I hope this helps.
It’s Just A Thought …