skip to main |
skip to sidebar
RSS Feeds
ASP.NET, JavaScript, Oracle and SQL articles and code.
ASP.NET, JavaScript, Oracle and SQL articles and code.
6:13 AM
Posted by Michael Heliso
It's been a while since I had to write custom HTTP handlers. One of my current projects required resourses to be provided using a custom HTTP handler. That was quite an easy job and for sure you will find many detailed posts related to HTTP handlers development under .NET. The only thing which gave me some headaches was the deployment of such a handler. There is a different approach under IIS7 (integrated mode) compared with IIS6. Here are the required steps:
1. From IIS management interface create a web application which points to the root folder where you have your HTTP handler. Please note that the actual DLL (assembly) should be located under root directory in a "bin" folder (e.g.: C:\MyHandlerRootFolder\bin\myhandler.dll). Please be sure that you are configuring your web application to run under the correct application pool. So if your HTTP handler assembly is compiled with .NET 4.0 be sure that the web application is configured to run under ASP.NET v4.0 application pool. My issue was caused by a missconfiguration of the HTTP handler. Due to this, everyt time when I was trying to access the handler I was getting the following exception: "Could not load type 'MyHandlerClass'"
2. In the web.config file which should be hosted in your web application root folder add (or change if it is the case) the following configuration elements:
<system.webServer>
<handlers>
<add verb="*" path="*.myextension"
name="MyHttpHandler"
type=" MyFullNamespace.MyHandlerClass, MyFullHttpHandlerAssemblyName"/>
</handlers>
</system.webServer>
10:55 AM
Posted by Michael Heliso
When I moved to windows 7 (clean install) I have done a mistake regarding the order in which I have set up the development environment. First, by mistake, I have installed Visual Studio 2008, .NET framework 3.5 and at the end .NET framework 2.0.*. This caused a big issue on IIS 7. Every virtual directory or application created on IIS caused an error on the application pool. I have tried different application pools but got same error: “The worker process failed to preload .Net Runtime version v2.0.40607” and “The worker process failed to initialize correctly and therefore could not be started. The data is the error.”. After some searched over the internet I have found a solution HERE. The fix consists in removing from Windows\Microsoft.Net\Framework of any folder like v2.0.* which is different than v2.0.50727.