Coder Social home page Coder Social logo

alexbeletsky / elmah-mvc Goto Github PK

View Code? Open in Web Editor NEW
266.0 25.0 61.0 1.2 MB

Painless integration of ELMAH into ASP.NET MVC application

Home Page: http://nuget.org/packages/Elmah.MVC

License: Apache License 2.0

C# 80.86% Batchfile 0.65% PLpgSQL 18.48%

elmah-mvc's Introduction

ELMAH.MVC

Build status Join the chat at https://gitter.im/alexbeletsky/elmah-mvc

For painless integration of ELMAH into ASP.NET MVC application.

What's changed in 2.0 version?

For details, please follow that blog post - ELMAH.MVC v.2.0 - Release Candidate

What's the goal?

With ELMAH.MVC you got nice and clear MVC style routing to ELMAH error page. ELMAH can be accessed by:

http://yourapp.com/elmah

By doing that, you can apply any authorization strategies or routes. In short, no more

http://yourapp.com/elmah.axd

That could be used for ASP.NET session hijacking with Google and ELMAH.

How to use in my application?

Easy. Install ELMAH by NuGet, in package console

Install-Package Elmah.MVC

For further ELMAH configuration please check the documentation.

Should I use HandleErrorAttribute?

If you tried to use ELMAH in ASP.NET MVC, you are probably implemented your own HandleErrorAttribute, as it's shown in this example. You no longer need to apply this custom code with Elmah.MVC. As soon you installed package, so can safely remove your HandleError attribute, since it's already included into package.

Will exceptions be logged in "customError='On'" mode?

Yes, even if you configured application to use custom error pages, the exception will be logged.

How can I configure Elmah.MVC?

There is a simple configuration section in web.config file.

<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.IgnoreDefaultRoute" value="false" />
	<add key="elmah.mvc.allowedRoles" value="*" />
	<add key="elmah.mvc.allowedUsers" value="*" />
	<add key="elmah.mvc.route" value="elmah" />
	<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
  • elmah.mvc.disableHandler - turn on/off ELMAH.MVC handler
  • elmah.mvc.disableHandleErrorFilter - by default HandleErrorAttribute() is set as global filter, to disable it, set value to "true"
  • elmah.mvc.requiresAuthentication - secure /elmah route with authentication
  • elmah.mvc.allowedRoles - in case of authentication is turned on, you can specify exact roles of user that have access (eg. "Admins")
  • elmah.mvc.allowedUsers - in case of authentication is turned on, you can specify exact users that have access (eg. "johndoe")
  • elmah.mvc.route - configure ELMAH.MVC access route

You can either disable handler or apply authentication, based on application roles.

You can also tweek the ELMAH default route. If you just install the package, ELMAH will be availabled at /elmah, howether if you would like to change that, change elmah.mvc.route, this setting is a MVC route prefix, used during ELMAH routes registration. For instance, if you change that to secure/admin/errors you will get ELMAH at http://yourapp.com/secure/admin/errors.

Default route issue

You might change the elmah.mvc.route to a custom one, but still able to see ELMAH reports at /elmah. This issue is caused by the way how ASP.NET MVC matches controllers in separate namespaces. There are no good workaround for that (at least one I know), so if I makes a trouble to you, I recommend to reconsider the application, without using default route.

UPDATE: You might also consider ignoring /elmah route explicitly as described here.

UPDATE 2: @chaoaretasty has added an option, to allow ignoring default role. Set elmah.mvc.IgnoreDefaultRoute setting option to true.

Related articles and posts

ELMAH.MVC 2.0.1 Update is Out

ELMAH.MVC v.2.0.0 - Release Candidate

ELMAH.MVC v2.0 is coming

Slides of ELMAH.MVC talk

ELMAH MVC controller released on NuGet

Integrating ELMAH to ASP.NET MVC in right way

Recent changes

  • 30-Apr-2015 - v.2.1.2 Added UserAuthCaseSensitive setting by @issafram. IgnoreDefaultRoute now works for subfolders by @DavidDeSloovere.
  • 09-Jul-2013 - v.2.1.1 fixes by @papci
  • 01-Jul-2013 - v.2.1.0 user based authentication by @papci
  • 02-Jun-2013 - v.2.0.3 ignoring default role by @chaoaretasty
  • 06-Nov-2012 - v.2.0.2 flag to turn on/off default HandleErrorAttribute()
  • 16-Aug-2012 - v.2.0.1 custom routes, VB.NET support
  • 13-Jun-2012 - v.2.0 major changes, packed to class library, HandleError attribute etc.
  • 11-Jan-2012 - minor style changes and readme correction
  • 29-Aug-2011 - nuget package created
  • 29-Aug-2011 - reimplemented controller to avoid usage of additional routing instructions

Licence

Apache 2.0

elmah-mvc's People

Contributors

alexbeletsky avatar alexcuse avatar andrexx avatar bennor avatar chaoaretasty avatar daviddesloovere avatar galilyou avatar gitter-badger avatar issafram avatar jamescrowley avatar mikecole avatar peterdew avatar seba-i avatar vkairys avatar zenuka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elmah-mvc's Issues

Integrating Elmah.MVC to Production code

Hi,
I am working on a MVC 4 project and I am trying to integrate Elmah.MVC to the application.
I copy pasted the web.config settings created in my Demo project using Elmah.MVC nuget package to production web.config file. Placed the elmah.MVC.dll and elmah.dll from packages\elmah.corelibrary.1.2.2\lib and \packages\Elmah.MVC.2.1.1\lib to Production bin folder. merged the packages.config file settings. but I am getting "500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.". Please let me know how to resolve it. I have not added the dll reference to my project as I dont want to rebuild my code.

Please let me know how to resolve the issue.

Is it possible to log to MSSQL and XML simultaneously?

Hi,

I just want to ask you whether it is possible to use ELMAH for logging to MSSQL and XML files simultaneously? In fact, I want to have exception records in XML files and MSSQL database as well.

Thanks for reply.
Ondrej Subrt

Having issues on MVC5

Somehow, Elmah.Mvc doesn't seem to comply with the binding redirects for MVC 5.
Still looks for System.Web.Mvc v3.0 (instead of 4.0).

Clearing olders logs

Hi,
I am looking for settings and MVC action for elmah which can show the logs for deleting...
and another action to delete the logs.

OR,
a way to indicate that don't parse all the log-files to count the total list. just parse first say 200 in reverse chronological order, only if we click on "next" after first 200, read the next.

Regards,
Amit

Elmah DLL SNK

Priviet Alexander,

Thank you for the great project. I ran into an issue with having to use the unsigned ELMAH dll that comes with the NUGET package.

I'd like to get a signed version of the dll for other projects.

So I followed up on Stackoverflow and Codeproject. To see how to Sign it.

I went to the source project from , signed, compiled and tried to use it in my project. But when I intentionally cause an error. The custom error page no longer works. For Example

    <customErrors mode="On" defaultRedirect="~/Views/Shared/Error.cshtml" />

When, I go back to using the dll that comes with the NUGET it works again.

Can someone sign the dll in the NUGET package thanks.This is the link I used to compile the dll and sign

    https://code.google.com/p/elmah/downloads/detail?name=ELMAH-1.2-sp2-src.zip 

Or just point me to the right project to use, I also decompiled the dll, recompiled the dll and tried to sign. That didn't work either.

Spyciba,

Alfredo

MVC 5.1 Attribute Routing and Elmah.MVC

Just added MVC 5.1 to a project with Attribute Routing. This breaks the custom Elmah.Mvc routing (especially with Areas). A simple work-around, for now, is in RouteConfig first Map attribute routes, then init Elmah.Mvc, then register areas:

    routes.MapMvcAttributeRoutes();
    Elmah.Mvc.Bootstrap.Initialize();
    AreaRegistration.RegisterAllAreas();

C# public action method 'stylesheet' was not found on controller

I downloaded the latest elmah via nuget and have your latest source code that fixes issue 14 and 16. In my MVC app in C# i still get 'A public action method 'stylesheet' was not found on controller...' Very similar to the post a few months back when a VB programmer saw the same error.
thanks

How to add my custom controller to elmah?

Hi, I have this small problem which I suggested on Stack Overflow. Long story short:

  1. I need to add a custom controller with custom authorization.

  2. I need to access it via route

    routes.IgnoreRoute("elmah");
    routes.MapRoute(
    name: "Admin_elmah",
    url: "admin/elmah",
    defaults: new { controller = "MyElmah", action = "Index" },
    namespaces: new string[] { "MyProject.FrontEnd.Main.Controllers" }
    );

  3. I access my controller with my authentication methods and then view Elmah as was.

Right now, I only managed to disable elmah.axd.
I added a controller which was something you wrote about here.
I modified the web.config appSetings to this:

<appSettings>
    <add key="elmah.mvc.IgnoreDefaultRoute" value="true" />
</appSettings>

The problem is that myapp/elmah is always available. When I go to myapp/admin/elmah it doesn't find the resource. Can you tell me what am I doing wrong in making my own custom controller to elmah.mvc?

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

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

FxCop and StyleCop issues in ElmahController and AdminAreaRegistration

Hello,

Nice product but a couple of minor annoyances. The code in ElmahController and AdminAreaRegistration generates alot of FxCop and StyleCop errors (when using those products with settings out of the box).

Could you make the generated code a bit more compliant to those standards?

Some FxCop issues:

  • Validate parameters
  • Make members static

Some StyleCop issues:

  • One class per file
  • Curly braces on new line

Thanks,

Callum

Elmah not logging 404 Not Found errors when using MVC Attribute Routing

All errors seem to be logged in Elmah except 404 Not Found errors. I have now narrowed this error down to a routing problem. I am using attribute routing only and do not have any calls to System.Web.MvcRouteCollectionExtensions.MapRoute anywhere in my routing configuration. As soon as I add the default MapRoute code back in, 404 Not Found errors are logged once more.

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("Content/{*pathInfo}");
        routes.IgnoreRoute("Scripts/{*pathInfo}");
        routes.IgnoreRoute("elmah");

        routes.MapMvcAttributeRoutes();

        // Removing the line below stops Elmah from logging 404 Not Found errors.
        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}

Ending slash in URL

Still two minor corrections for that version:

In ElmahResult, in subroutine public override void ExecuteResult(ControllerContext context)

After this statement there
if (!string.IsNullOrEmpty(m_resouceType))
{...}
add

        // BugFix
        if (context.HttpContext.Request.RawUrl != null)
        {
            if (context.HttpContext.Request.RawUrl.EndsWith("/elmah/", StringComparison.OrdinalIgnoreCase))
                context.HttpContext.RewritePath(context.HttpContext.Request.RawUrl.TrimEnd('/'));
        }

And in ElmahController.cs,
public ActionResult Index(string type)

{

return new ElmahResult(type);

}

instead of

public ActionResult Index()

This will make it possible that it also works
with this url:
http://localhost:57443/elmah/
instead of just
http://localhost:57443/elmah

and also

http://localhost:57443/admin/elmah/
instead of just
http://localhost:57443/admin/elmah

Otherwise, it doesn't find the stylesheets when the url ends with / because the url will be /elmah//stylesheet.css.
Just my additional 5 cents ;)

Please add some smarts to web.config.transform?

Several weeks ago I updated my elmah.mvc installation, and just yesterday I discovered that my existing elmah.mvc.allowedUsers and allowedRoles values had been overwritten by new ones containing *, which meant my elmah logs have been available to anyone.

Is it possible to add some conditionals to web.config.transform to ensure that existing values aren't overwritten by these new ones?

Allow OracleErrorLog to use Oracle.ManagedDataAccess

I just updated my web application based on an oracle database to use the Oracle.ManagedDataAccess. Now I don't have to install the oracle client on every development machine as well as on every other server, that I want to run my system on. The only thing missing is that Elmah is able to connect through this Oracle.ManagedDataAccess. I have tried to look at the code to see, if I could do some refactoring myself, but I could not find the correct location to make the changes.

Always getting 403

I am always getting 403 - File access denied and I do not know why.

I setup the auth on and with the role and it works on my localhost but when pushed to my server it does not work.

HTTP Error 500.19 - Internal Server Error

I'm having problems with the config entries that are created by elmah-mvc.

I get an http error
HTTP Error 500.19 - Internal Server Error
Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ErrorLog'

" "

I've tried completely clearing the web.config of all Elmah entries - removing Elmah MVC at which point the project runs fine. Then use Nuget to get Elmah MVC and it produces the error again.

Html() action missing

Elmah generates links that have the ability to show the original ASP.NET error page for some errors (not for all and I do not know what makes it render those links and what doesn't), however your Elmah controller is missing this action.

It's the Html() action and it goes like this:

    public ActionResult Html() {
        return new ElmahResult("html");
    }

Internal Server Error error code 500 is logged as 0

What steps will reproduce the problem?
1.Cause a 500 error in your site.
2.View the /elmah.axd page
3.View the error and the code column.
4.See that the error is logged with a code of zero instead of 500.

What is the expected output? What do you see instead?
You should see a 500 instead of zero.

Please use labels and text to provide additional information.
Comment #20 in the following issue talks about this bug but I have raised it as an issue to be addressed.
https://code.google.com/p/elmah/issues/detail?id=217

I have also raised this issue with Google Elmah here.

MVC 3 and Elmah.MVC 2.1.2, different versions of System.Web.WebPages

I recently installed the Elmah.MVC nuget package, version 2.1.2 on my existing MVC 3 project. Locally, it runs fine. Once I uploaded to the site, navigating to my elmah route generates the following error:

Could not load file or assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It appears Elmah wants System.Web.Webpages Version 2, but MVC 3 uses Version 1. Is it possible to use both versions?

Json and Xml action methods are missing

Thanks for the nuget package!

Please add the following http gets to the Elmah controller class:
(These are links available in the Error Details section)
See also:

Raw/Source data in XML or in JSON

    /// <summary>
    /// Gets the JSON instance for the error detail see also area.
    /// </summary>
    /// <returns></returns>
    public ActionResult json()
    {
        return new ElmahResult("json");
    }

    /// <summary>
    /// Gets the XML instance for the error detail see also area.
    /// </summary>
    /// <returns></returns>
    public ActionResult Xml()
    {
        return new ElmahResult("xml");
    }

I don't know if you're actually editing the config file too yet if you are, could you change the Elmah path to be:
path="/admin/elmah.axd"
so when you uncomment the authorize attribute on your controller users cannot access the ~/elmah.axd as an unauthorized user. Thanks!

Get Error When trying to install from nuget

Hi

I get this error when I try to install from nuget

Data at the root level is invalid. Line 1, position 1.
Successfully uninstalled 'elmah 1.2.0.1'.
Successfully uninstalled 'elmah.corelibrary 1.2.1'.
Install failed. Rolling back...
Data at the root level is invalid. Line 1, position 1.

Errors aren't logged under MVC 4 on .NET 4

As per the title, ELMAH isn't logging errors for an MVC 4 project running under .NET 4 when custom errors are on. Here's how to repro:

  1. Create a brand new ASP.NET MVC 4 web app running on .NET 4 in VS 2012 RC
  2. Add Elmah.MVC via NuGet
  3. Add an unhandled exception to the index action on the home controller such as "var foo = new Guid("x")"
  4. Run the app, hit the error then you'll see it on the ELMAH handler page
  5. Turn custom errors on, repeat the previous step and there'll be no error

I also tried registering an exception filter and raising the error on handled exceptions bot no good: http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/5936867#5936867

Capturing HttpRequestValidationException

Hello,
ELMAH does not catch HttpRequestValidationException by default and if a user sends an invalid request it will be missed in ELMAH's report. so it's necessary to define and use this filter as well:

public class ElmahRequestValidationErrorFilter : IExceptionFilter
{
    public void OnException(ExceptionContext context)
    {
        if (context.Exception is HttpRequestValidationException)
           ErrorLog.GetDefault(HttpContext.Current).Log(new Error(context.Exception));
    }
}

Unexplained NullReferenceException

Good afternoon,

I've recently added the elmah-mvc solution to a project and it works perfectly in iisexpress in local development. However, when deployed to the web server, it throws this NullReferenceException. I've browsed the code, but without a line number and no way to reproduce it locally, I don't have any idea about how to narrow it down any further. There are other applications on this IIS instance that use Elmah successfully, so I don't suspect a server problem.

System.NullReferenceException: Object reference not set to an instance of an object. 
  at Elmah.Mvc.ElmahResult.ExecuteResult(ControllerContext context) 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass1e.<>c__DisplayClass28.<BeginInvokeAction>b__19() 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() 
  at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) 
  at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() 
  at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) 
  at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) 
  at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) 
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() 
  at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 
  at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) 
  at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I'm really at a loss. I'm happy to help troubleshoot, but I'm not even clear what else to try.

elmah.mvc in mvc4 + visual basic project

My project is

  1. Visual Studio 2012 RC
  2. Visual Basic
  3. ASP.NET MVC 4, Internet

I run elmah.mvc in my Visual Basic + mvc4 project (url http://localhost:3302/elmah), will have a stylesheet Error. (C# project is great)
Can you fix it?

Details Log:

A public action method 'stylesheet' was not found on controller 'Elmah.Mvc.ElmahController'.
Errors
Help
About
System.Web.HttpException: A public action method 'stylesheet' was not found on controller 'Elmah.Mvc.ElmahController'.

System.Web.HttpException (0x80004005): A public action method 'stylesheet' was not found on controller 'Elmah.Mvc.ElmahController'.
於 System.Web.Mvc.Controller.HandleUnknownAction(String actionName)
於 System.Web.Mvc.Controller.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult)
於 System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
於 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End() 於 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) 於 System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 於 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
於 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
於 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
於 System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.b__4(IAsyncResult asyncResult)
於 System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult ar)
於 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
於 System.Web.Mvc.MvcHandler.<>c__DisplayClasse.b__d()
於 System.Web.Mvc.SecurityUtil.b__0(Action f)
於 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
於 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
於 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
於 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
於 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Logged on 2012年8月10日 at 下午 04:46:17

See also:

Raw/Source data in XML or in JSON
Server Variables

Name Value
ALL_HTTP HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:text/css HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:zh-TW HTTP_HOST:localhost:3302 HTTP_REFERER:http://localhost:3302/elmah HTTP_USER_AGENT:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
ALL_RAW Connection: Keep-Alive Accept: text/css Accept-Encoding: gzip, deflate Accept-Language: zh-TW Host: localhost:3302 Referer: http://localhost:3302/elmah User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
APPL_MD_PATH /LM/W3SVC/7/ROOT
APPL_PHYSICAL_PATH D:\CodeTest\VS11\MVC4\MvcApplication1\MvcApplication1\
AUTH_PASSWORD *****
AUTH_TYPE
AUTH_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH 0
CONTENT_TYPE
GATEWAY_INTERFACE CGI/1.1
HTTP_ACCEPT text/css
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE zh-TW
HTTP_CONNECTION Keep-Alive
HTTP_HOST localhost:3302
HTTP_REFERER http://localhost:3302/elmah
HTTP_USER_AGENT Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
HTTPS off
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID 7
INSTANCE_META_PATH /LM/W3SVC/7
LOCAL_ADDR ::1
LOGON_USER
PATH_INFO /elmah/stylesheet
PATH_TRANSLATED D:\CodeTest\VS11\MVC4\MvcApplication1\MvcApplication1\elmah\stylesheet
QUERY_STRING
REMOTE_ADDR ::1
REMOTE_HOST ::1
REMOTE_PORT 12201
REMOTE_USER
REQUEST_METHOD GET
SCRIPT_NAME /elmah/stylesheet
SERVER_NAME localhost
SERVER_PORT 3302
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/8.0
URL /elmah/stylesheet

Powered by ELMAH, version 1.2.14706.955. Copyright (c) 2004, Atif Aziz. All rights reserved. Licensed under Apache License, Version 2.0. Server date is Friday, 10 August 2012. Server time is 16:47:59. All dates and times displayed are in the 台北標準時間 zone. This log is provided by the XML File-Based Error Log.

elmah.mvc 2.0.2: elmah.mvc.allowedRoles not working in MVC3

For some reason i am not able to specify roles that should be allowed access to the error log. No matter what role i enter (i have Admin, Super and Test roles), my app just redirects to the login screen, which is the expected behaviour should i not be authorized. If i choose to allow all roles with the * it works just fine, but allows all roles when i need to restrict it to Super role only.

I have the following in my web.config file:

<add key="loginUrl" value="~/Login/" />
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.route" value="elmah" />

Client-side script error logging

Would be great to offer a solution for client-side script error logging, as described here: http://stackoverflow.com/a/13370468.

(Disclaimer: Don't be fooled, this is a feature request. If I should have posted this elsewhere, first of all let me express my most sincere apologies. Also let me know where I should post this instead and I'll do just that.)

Doesn't work with an oracle database

Hi,
I have an asp.net mvc4 application and I'm looking to do the error handling with elmah.
I want to save my log in an oracle database so I ran the oracle.sql script from the source of elmah. But with this web.config(bellow), I can't acces to the elmah page with all the log and nothing is store into the database :

<connectionStrings>
    <add name="elmah-oracle" connectionString="data source=****;password=******;user id=*****"/>
<\connectionStrings>
....
<elmah>
    <errorLog type="Elmah.OracleErrorLog, Elmah" connectionStringName="elmah-oracle" />
<\elmah>

And also, everything works fine if I'm using xml files as storage.
Thanks for your help

anonymous web with elmah.mvc.requiresAuthentication = true

Retrofitting some anonymous webs on IIS 6, 7, and 7.5 with elmah.mvc.

The goal is to allow remote secure access to the elmah route. However when I set requiresAuthenication to "true", the elmah route redirects to error even on the local web server. Note allowedRoles is "*".

Tried number combinations of IIS, system.web, system.webServer configurations but to no avail. Can a sample machine, application host, and/or web config be added to the repository as reference for a anonymous web with widows authenticated elmah.

Custom path to Elmah

I liked it much better when I could control the path to Elmah by placing it in the appropriate Area etc
Now the URL is fixed - could you provide a customization for this?

HandleError attribute

When I moved accross to using Elmah.MVC I thought I could remove my custom error handler code that I implemented based on this question:

http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute

My custom error handler means I can show users a nice error message and still log elmah errors. Removing it though meant the errors were no longer logged.

Does elmah.mvc deal with this issue in a different way and I've not configured it right, or is it out of the scope of this very excellent module.

Are we need remove the asp.net mvc original HandleErrorAttribute from RegisterGlobalFilters?

When we create the asp.net mvc project, there is already has a HandleErrorAttribute register to global filter:

public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
    }

but I see the elmah-mvc register it own HandleErrorAttribute too.
that mean there is 2 HandleErrorAttribute now.

So My question is , Are we need remove the original HandleErrorAttribute? then there is only elmah-mvc own HandleErrorAttribute.

Callback/hook for custom code in the controller

Is it possible to get access to the controller, so I can mess with the Elmah output? I can't find anywhere to hook into. I looked at the source, but not sure where to start.

The controller is marked as "internal", and it is not possible to override anything.

I'd like to have a hook/callback/whatever from that controller, so I can, for example, inject custom javascript into the ouput which I can use to fiddle with the Elmah table, without having to recompile Elmah with my customisations. If the Elma.MVC package allowed this, then that would be the easiest way...

Any thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.