Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Http Handlers IIS7 and ASP.NET

Tags:

asp.net

iis-7

We have some HTTP handlers specified in our web.config. When we were running this site via a Web Site Project, all worked fine. But for some reason, after porting this over to a WAP project and pointing to the .NET 3.5 framework, the handlers are not working when I bring up the site in IIS 7 on our dev box. Do I need to do something special in IIS7 other than the specified custom handlers that already exist in my web.config?

When I look at the Handler Mappings section in IIS 7 for our site, I do see the 3 handlers listed with our custom extension. So it looks like it's picking up our handlers specified in our web.config. But I know that the handlers that were working in a non-wap website are not working in this WAP project and I don't know why.

For example, when one of our handlers tries to kick in when referenced I get:

Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'jaxHandler'.

Source Error:

Line 1:  
Line 2:  
Line 3:  using System;


Source File: /jaxHandler.ashx    Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074 

furthermore, when I try to click on a hyperlink on our site that has .customextension on it the handler doesn't seem to pick it up.

So when I click on the hyperlink, I get:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error InformationModule IIS Web Core 
Notification MapRequestHandler 
Handler StaticFile 
Error Code 0x80070002 
Requested URL http://sss:80/somename.prod
Physical Path C:\www\sss\somename.prod 
Logon Method Anonymous 
Logon User Anonymous 

(I have replaced the real text with 'somename' and our company name with 'sss') in the case above for privacy.

If I look in the Http Handlers section in IIS7, I do see that *.prod is registered. And here is how we have it set up in our web.config under the custom section:

<add name="sss" path="*.prod" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="bitness32"/>
like image 619
PositiveGuy Avatar asked Aug 13 '09 16:08

PositiveGuy


1 Answers

For ASP.NET applications running on IIS7, HttpHandlers should be mapped in the <system.webServer> section of your web.config. In IIS6, they were mapped in the <system.web> section.

<system.webServer>
    <handlers>
        <add name="HandlerName" 
             path="HandlerPath" verb="*" type="Handler.Type"
             resourceType="Unspecified" />
    </handlers>
</system.webServer>
like image 189
Kevin Babcock Avatar answered Nov 04 '22 19:11

Kevin Babcock