ASP.NET – HTTP Handlers not working on Azure

You are developing a web application and having some HTTP Handlers configuration in the Web.config file, that work fine on localhost. But after you have deployed the app to Azure, the HTTP handlers do not work anymore.

Basically, the cause of the problem is that your localhost is running in Classic Mode, while Azure is running in Integrated Mode.

Therefore, in order to fix the problem, you simply register HTTP Handlers for IIS running in Integrated Mode as shown right below:

Web.config
<?xml version="1.0"?>

<configuration>
  <system.web>
    <httpHandlers>
      <add verb="GET" path="MyHandler.ashx" 
        type="MyWebApp.Web.MyHandler"/>
    </httpHandlers>
  </system.web>

  <system.webServer>
    <handlers>
      <!-- Register the HttpHandler used for My Handler requests (IIS 7.0+ running in Integrated Mode)  -->
      <add name="MyHandler" preCondition="integratedMode" 
        verb="GET" path="MyHandler.ashx"
        type="MyWebApp.Web.MyHandler"/>
    </handlers>
  </system.webServer>
</configuration>

 

Learn more about How to: Register HTTP Handlers.

0 0 vote
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x