alexbeletsky/elmah-mvc

ELMAH MVC 2.0.2 - Error 404 (Resource not found) on Production/Test Servers

Opened this issue · 0 comments

I'm sure this question has been asked many times but believe me I've tried every possible solution.

Scenario : I am using ELMAH MVC 2.0.2 in my MVC3 project and everything works perfect on my local machine. When I deploy the code on Prod/Test Servers I get the dreaded '404 Resource not found' error message. I have tried adding the relevant code to the tags but that didn't work. I was using XMLLogging on my local machine and thought it might be a folder permission issue so tried my luck using Memory logging but had no luck.

Code :

Web.Config

<configuration>
  <configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
  </configSections>

  <appSettings>
      <add key="elmah.mvc.disableHandler" value="false" />
      <add key="elmah.mvc.disableHandleErrorFilter" value="false" />
      <add key="elmah.mvc.requiresAuthentication" value="false" />
      <add key="elmah.mvc.allowedRoles" value="*" />
      <add key="elmah.mvc.route" value="elmah" />
  </appSettings>

  <system.web>
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
    <httpHandlers>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    </modules>
    <handlers>
      <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
  </system.webServer>

  <elmah>
    <errorLog type="Elmah.MemoryErrorLog, Elmah" size="50" />
    <!--<errorLog type="Elmah.XMLFileErrorLog, Elmah" logPath="D:\\ELMAH" />-->
  </elmah>
</configuration>

Global.asax.cs

namespace abc
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new ElmahHandledErrorLoggerFilter());
            filters.Add(new HandleErrorAttribute());
        }

public static void RegisterRoutes(RouteCollection routes)
{
    string actionMethod = System.Web.Configuration.WebConfigurationManager.AppSettings.Get("actionpage");
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    //routes.IgnoreRoute("elmah.axd/{*pathInfo}");

    routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "abc", action = actionMethod, id = UrlParameter.Optional } // Parameter defaults
);
}

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    Telerik.Web.Mvc.WebAssetDefaultSettings.ScriptFilesPath = @"~/Scripts/2011.1.315/";

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);
  }
}

}
I have also tried to configure Handler Mappings and Modules in IIS Manager but that didn't work either. I am not sure if I need to make any changes to the applicationhost.config file.
I have site minder installed on IIS7 on Test/Prod server and the site is protected. Is there a chance that's causing a problem? Any help will be appreciated.

Thanks