Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (45.3k points)

I have an ASP.NET MVC web role running on Windows Azure and have set up ELMAH properly in the web.config. I also have my global.asax ignore *.axd routes. Locally, I am able to load /elmah.axd, however when I deploy to Azure, I get a 404 on that page. Has anyone gotten ELMAH working on Azure?

1 Answer

0 votes
by (16.8k points)

Populate the system.webServer part of the web.config file since Azure is based on the WINDOWS SERVER 2008 and IIS7.

The sample file included with elmah's source code contains the details that you need to put in.

<system.webServer>

  <validation validateIntegratedModeConfiguration="false"/>

  <modules>

    <remove name="ScriptModule" />

    <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>

  </modules>

  <handlers>

    <remove name="WebServiceHandlerFactory-Integrated"/>

    <remove name="ScriptHandlerFactory" />

    <remove name="ScriptHandlerFactoryAppServices" />

    <remove name="ScriptResource" />

    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"

         type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"

         type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

    <add name="elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />

  </handlers>

</system.webServer>

You need to include the 2 elmah lines in the above block of your xml, and section in your general must not contain most of them, if not all the elements.

Also, as per the new update, you don't need to include this file, as it there now by default:

<WebRole name="WebRole" enableNativeCodeExecution="true">

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...