问题
I am having issues with regards to running my ASP.NET MVC application thru my local IIS 5.1 web server. I believe these issues are related to IgnoreRoutes, but I can't seem to craft an IgnoreRoute such that it resolves the problem.
Problem:
I am able to view my elmah error page (localhost/mvcapplication1/elmah.axd), however, the CSS is missing and none of the links work.
Steps to Reproduce
1) Create an ASP.NET MVC 1.0 Application
2) Add Elmah. Download the assemblies, add them to your project and use the steps from Elmah Setup Instructions
3) Switch your application to 'Use Local IIS Web Server' from Property Pages --> Web
4) Add the wildcard mapping. That is, open up IIS, go to properties --> Virtual directory --> Configuration --> Add: Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll Extension: .* Limit To: GET, HEAD, POST, DEBUG Uncheck 'Check that file exists'.
5) Verify that routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
exists in the RegisterRoutes of your Global.aspx. By the way, I have also tried routes.IgnoreRoute("elmah.axd");
Now.. run the app and bring up localhost/mvcapplication1/elmah.axd.
No CSS and links are broken.
If I remove the wildcard mapping, all is fine, but then the application URL routing no longer works. I understand that, but I should be able to pull up the elmah.axd with the proper IgnoreRoute scheme.
Thoughts??
回答1:
Add FixIIS5xWildcardMapping module to your web.config:
<httpModules>
<add name="FixIIS5xWildcardMapping" type="Elmah.FixIIS5xWildcardMappingModule, Elmah"/>
</httpModules>
来源:https://stackoverflow.com/questions/982267/how-to-get-elmah-working-with-asp-net-and-iis-5-1-url-routing