I\'ve tried to use elmah with my asp.net site but whenever I try to go to http://localhost:port/elmah.axd I get resource not found exception. My web.config is given below.
One way to get around it today is to use nuget.
Visual studio:menu->tools->library package manager->package manager console
install-package elmah
HTH
I just had a similar problem with Elmah not working in an IIS7 deployment. I found that I needed to register the Elmah Modules and Handlers in system.web
AND system.webServer
:
<system.web>
...
<httpHandlers>
...
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
...
</httpHandlers>
<httpModules>
...
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
...
</httpModules>
...
</system.web>
<system.webServer>
...
<modules runAllManagedModulesForAllRequests="true">
...
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
...
</modules>
<handlers>
...
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
...
</handlers>
<system.webServer>
The nuget package does not add the following important lines to web.config resulting in 403 error.
<configuration>
<elmah>
<security allowRemoteAccess="1" />
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/app_data/elmah" />
</elmah>
</configuration>
Also you may want to restrict the access to error logs by
<add name="Elmah" verb="POST,GET,HEAD" path="/admin/elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
if you are using Areas make sure that you have updated one of the appsetting key
Default
<add key="elmah.mvc.route" value="elmah" />
If you are an area as Admin
<add key="elmah.mvc.route" value="admin/elmah" />
Try registering the Modules and Handlers in the sections "httphandlers" and "httpmodules" in the <system.web>
section:
<httpHandlers>
......
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
.....
</httpHandlers>
<httpModules>
.......
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
.......
</httpModules>
This line was missing when I installed using NuGet (VS 2013, IIS 8.0):
<system.webServer>
<handlers>
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</handlers>
</system.webServer>
Adding it solved the 404 error problem.