elmah

elmah: exceptions without HttpContext?

萝らか妹 提交于 2019-11-26 19:49:16
问题 I spawn a thread on Application_Start and would like to log exceptions. There is no Context/HttpContext/HttpContext.Current , so how might I get it to log? At the moment, it does not catch any exception in my threads and if I write ErrorSignal.FromCurrentContext().Raise(ex); I get an error about context cannot be null. Maybe I can create a dummy HttpContext but somehow I don't think that will work well. -edit- I tried ErrorSignal.Get(new HttpApplication()).Raise(ex); and it doesn't seem to

How to configure ELMAH to work with Windows Azure? I get a 404 on Elmah.axd

白昼怎懂夜的黑 提交于 2019-11-26 19:14:45
问题 I have an ASP.NET MVC web role running on Windows Azure and have setup 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: Azure is based on Windows Server 2008 and IIS7. This means that you need to populate the system.webServer part of the web.config file. The sample file included with elmah's source code contains the

Elmah: How to get JSON HTTP request body from error report

心已入冬 提交于 2019-11-26 17:49:55
问题 I'm using Elmah to log exceptions. Elmah is great at logging request bodies if the request is a Form-based request (i.e. Content-Type: application/x-www-form-urlencoded), but with JSON based requests where the content type is application/json, the request body is nowhere to be found in the error reports. Anyone know where I can find this request body so that I can properly diagnose my exceptions? UPDATE: 2012-01-03 As a clarification on what I mean by JSON based requests, here's an example

Using ELMAH in a console application

送分小仙女□ 提交于 2019-11-26 17:03:48
I just started using ELMAH and am a fan. My team supports a large number of web applications and I'm particularly excited that ELMAH lets us save exceptions from each application to the same MS SQL database table. We also support a few console, DLL and desktop applications. Is it possible to use the ELMAH DLL to log exceptions in these apps to that same location? We have exactly the same situation here. Running ELMAH for all our web applications. A few of them have console based schedulers. After doing some digging through the source code, the following code seems to work: ErrorLog errorLog =

How to use ELMAH to manually log errors

怎甘沉沦 提交于 2019-11-26 15:36:42
Is it possible to do the following using ELMAH? logger.Log(" something"); I'm doing something like this: try { // Code that might throw an exception } catch(Exception ex) { // I need to log error here... } This exception will not be automatically logged by ELMAH, because it was handled. Andrey Kamaev Direct log writing method, working since ELMAH 1.0: try { some code } catch(Exception ex) { Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex)); } ELMAH 1.2 introduces a more flexible API: try { some code } catch(Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex);

Exception Logging for WCF Services using ELMAH

試著忘記壹切 提交于 2019-11-26 11:50:04
问题 We are using the excellent ELMAH to deal with unhandled exceptions in an ASP.NET 3.5 web application. This works extremely well for all of the site apart from WCF services which are being consumed using the REST features. When an exception occurs within the operation methods that is not handled by the application code, WCF handles it in various ways depending on the service contracts and configuration settings. This means that the exception does not end up firing the ASP.NET HttpApplication

Could not load file or assembly 'System.Data.SQLite'

天大地大妈咪最大 提交于 2019-11-26 11:37:02
I've installed ELMAH 1.1 .Net 3.5 x64 in my ASP.NET project and now I'm getting this error (whenever I try to see any page): Could not load file or assembly 'System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: Could not

Elmah not working with asp.net site

微笑、不失礼 提交于 2019-11-26 07:54:54
问题 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. <?xml version=\"1.0\"?> <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=\"errorMail\"

How to use ELMAH to manually log errors

柔情痞子 提交于 2019-11-26 05:56:57
问题 Is it possible to do the following using ELMAH? logger.Log(\" something\"); I\'m doing something like this: try { // Code that might throw an exception } catch(Exception ex) { // I need to log error here... } This exception will not be automatically logged by ELMAH, because it was handled. 回答1: Direct log writing method, working since ELMAH 1.0: try { some code } catch(Exception ex) { Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex)); } ELMAH 1.2 introduces a more

Using ELMAH in a console application

白昼怎懂夜的黑 提交于 2019-11-26 05:16:08
问题 I just started using ELMAH and am a fan. My team supports a large number of web applications and I\'m particularly excited that ELMAH lets us save exceptions from each application to the same MS SQL database table. We also support a few console, DLL and desktop applications. Is it possible to use the ELMAH DLL to log exceptions in these apps to that same location? 回答1: We have exactly the same situation here. Running ELMAH for all our web applications. A few of them have console based