は、ここで私は私のGlobal.asax.vbでやろうとしているものです:ASP.NET MVCで未処理の例外をログに記録するにはどうすればよいですか?
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute(_
"Error", _
"error.html", _
New With {.controller = "Error", _
.action = "FriendlyError"} _
)
...
'other routes go here'
...
End Sub
Sub Application_Start()
RegisterRoutes(RouteTable.Routes)
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
...
'code here logs the unhandled exception and sends an email alert'
...
Server.Transfer("http://www.example.com/error.html")
End Sub
End Class
をしかし、Server.Transferのは失敗していること:
Invalid path for child request 'http://www.example.com/error.html'. A virtual path is expected.
私はこの問題を解決するにはどうすればよいです?それとも、これを行うためのより良い方法は何ですか?
ここでは、スタックオーバーフローでELMAHの修正版を使用しています。これは非常に優れています。 –
@Jarrod - フォークにはどんな種類のものが含まれていますか? –
ELMAHのルール - log4netよりも役立ちました。私見では。 – MikeJ