Thursday, 15 April 2010

How to register an HTTP handler for IIS 7.0 running in Integrated Mode

#Compile the HTTP handler class and copy the resulting assembly to the Bin folder under the application's root folder.
-or-
Put the source code for the handler into the application's App_Code folder.

For an example of an HTTP handler, see Walkthrough: Creating a Synchronous HTTP Handler.

#In the application's Web.config file, create a handlers element in the system.webServer section.

Note

Handlers that are defined in the httpHandlers element are not used. If you do not remove the httpHandlers registrations, you must set the validation element’s validateIntegratedModeConfiguration attribute to false in order to avoid errors. The validation element is a child element of the system.webServer element. For more information, see "Disabling the migration error message" in ASP.NET Integration with IIS 7.0.

The following example shows how to register an HTTP handler that responds to requests for the SampleHandler.new resource. The handler is defined as the class SampleHandler in the assembly SampleHandlerAssembly.

<configuration>
<system.webServer>
<handlers>
<add name="SampleHandler" verb="*"
path="SampleHandler.new"
type="SampleHandler, SampleHandlerAssembly"
resourceType="Unspecified" />
</handlers>
<system.webServer>
</configuration>

Note

The resourceType attribute performs the same function as the Verify file exists option in IIS manager for IIS 6.0.

Read More>>

No comments:

Post a Comment