JG Vimalan's Blog

It is all about coding!

httpHandlers vs handlers in web.config

One of my colleague told to me that, the http handlers he created are working in his development system and not in QC environment. From his statement I understood that there is an environment difference.

When I looked at his system, it is Windows Server 2003 and the QC environment is Windows Server 2008 R2. So, the problem is because of the difference in IIS version and in registering the http handlers.

Windows Server 2003 is IIS 6 and Windows Server 2008 R2 is IIS 7.5. So, in the web.config file, the http handlers should be registered in two locations,

a. <httpHandlers> for IIS 6

Example:

<httpHandlers>
<add verb=”*” path=”Update.ashx” type=”DemoProject.WebUI.Handlers.Update, DemoProject.WebUI”/>
</httpHandlers>

b. <handlers> for IIS 7 and above

Example:

<system.webServer>
<handlers>
<add name=”Update” path=”Update.ashx” verb=”*” type=”DemoProject.WebUI.Handlers.Update” resourceType=”Unspecified” preCondition=”integratedMode” />
</handlers>
</system.webServer>

this will solve the problem.

Advertisements

July 31, 2011 Posted by | ASP.NET | 2 Comments