Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseElmahExceptionPage under IIS sub-application #152

Open
FuncLun opened this issue Oct 19, 2022 · 1 comment
Open

UseElmahExceptionPage under IIS sub-application #152

FuncLun opened this issue Oct 19, 2022 · 1 comment

Comments

@FuncLun
Copy link

FuncLun commented Oct 19, 2022

It appears that the Elmah Exception Page does not work properly while running under an IIS sub application.

Assume running an app under IIS and the "/" application is not running MVC. But an mvc6 application is deployed to "/mvc6". Using the default options for Services.AddElmah() and app.UseElmahExceptionPage() works fine while accessing the error page (i.e. "/mvc/elmah"). But, when an exception occurs, the redirect url is "/elmah/detail/{guid}", which is to the root application.

Updating the ElmahOptions.Path to various values does not resolve the issue.

"elmah"
Same behavior as not setting
Elmah error page works at "/mvc6/elmah"
Elmah redirect is to "/elmah/detail/{guid}" and is a 404
If I modify the error redirect to "/mvc6/elmah/detail/{guid}", the error page displays
The detail page incorrectly updates the URL. If the exception occured on "/mvc6/controller/action", the url becomes "/controller/action". (This appears to be a .pushState() and not a redirect.)

"~/elmah"
Elmah error page does not work
Elmah redirect is to ~/elmah/detail/{guid} (the ~ is not translated)

"/mvc6/elmah"
Elmah error page works at /mvc6/mvc6/elmah
Elmah redirect is to /mvc6/elmah/detail/{guid} and is a 404

A possible fix is to modify ErrorLogMiddleware.InvokeAsync(HttpContext context) to and replace "~/" with HttpContext.Request.PathBase.

@FuncLun
Copy link
Author

FuncLun commented Oct 20, 2022

I have fixed this in 0350dd2. Waiting for PR review/completion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant