ServiceStack/ServiceStack.Logging — pull request #17 by AkosLukacs (2013-05-22 14:18:00+00:00)
Title: In IIS integrated mode Elmah fails at application start (Can't access 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:
```C#
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.