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 »

  1. Thank you for so succinctly and clearly defining this, and putting the information under an easily-searched title as well! This problem was causing me grief, just trying to test a simple handler under Visual Studio 2010 – it seems the built-in test web-server requires the IIS 6 handler definition; something that does not seem to be mentioned in any of the documentation.

    Comment by Michael | August 15, 2011 | Reply

  2. Thank you!! stumbled over when I tried to find some assistance on this issue and your solution worked for me!

    Comment by Harinath | November 9, 2012 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: