Commit 3a99d50
committed
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:
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.1 parent 4461970 commit 3a99d50
2 files changed
Lines changed: 36 additions & 6 deletions
Binary file not shown.
Lines changed: 36 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
52 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
58 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
62 | 77 | | |
63 | 78 | | |
64 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
65 | 85 | | |
66 | 86 | | |
67 | 87 | | |
68 | 88 | | |
69 | 89 | | |
70 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
71 | 96 | | |
72 | 97 | | |
73 | 98 | | |
74 | 99 | | |
75 | 100 | | |
76 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
77 | 107 | | |
78 | 108 | | |
79 | 109 | | |
| |||
0 commit comments