In IIS integrated mode Elmah fails at application start (Can't access HttpContext.Current.Request)#17
Merged
Conversation
… HttpContext.Current.Request) A workaround is described here: http://stackoverflow.com/a/2196594/618331 Just wrapped the normal Elmah log statements in try-catch and added the workaround Elmah log statements in the catch{} blocks. Can't create a real test for it, because it happens only at Application_start... A dummy global.asax.cs: protected void Application_Start() { try { //do something... } catch(Exception exc) { //try logging logger.Error("something went wrong...", exc); //this is line 50 } } The exception: System.Web.HttpException (0x80004005): Request is not available in this context at System.Web.HttpContext.get_Request() at Elmah.ErrorLog.InferApplicationName(HttpContext context) at Elmah.ErrorLog.GetDefaultImpl(HttpContext context) at Elmah.ServiceContainer.GetService(Type serviceType) at Elmah.ErrorLog.GetDefault(HttpContext context) at ServiceStack.Logging.Elmah.ElmahInterceptingLogger.Error(Object message) at x.Application_Start() in x\Global.asax.cs:line 50 Also had to update Nuget.exe because The schema version of 'NLog' is incompatible with version 1.6.21205.9031 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
mythz
added a commit
that referenced
this pull request
May 22, 2013
In IIS integrated mode Elmah fails at application start (Can't access HttpContext.Current.Request)
Contributor
|
k kool thx. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A workaround is described here: http://stackoverflow.com/a/2196594/618331
Just wrapped the normal Elmah log statements in try-catch and added the workaround Elmah log statements in the catch{} blocks.
Can't create a real test for it, because it happens only at Application_start...
A dummy global.asax.cs:
The exception:
Also had to update Nuget.exe because
The schema version of 'NLog' is incompatible with version 1.6.21205.9031 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.