UrlMapping giving 404 Page not found on IIS but working fine on local server port
Well I am having a problem when I have put my .NET 2.0 web site on IIS 6. I have used UrlMapping to redirect some old urls. It is working fine when I am using it on the VS local server port but when I deploy it to IIS 6, its giving a 404 Page not found error.
I've found that in a few forums they are talking about using Wildcard Mapping, but none of them provide me with a good explanation of how to achieve this. Added to this, what are the security risks of doing such a modifi开发者_高级运维cation on IIS Level (if there are any?)
Thanks in advance, Cheers :)
Crack open IIS on the target server.
Go to your Web Application, right-click and select Properties
Select the Virtual Directory tab
Click on the Configuration button under Application settings
In the Wildcard application maps section, add this:
c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Make sure you unchecked File exists.
What is likely causing your issue is that in the ASP.NET mapping on IIS, there is a check box "check that file exists" uncheck this and you should be fine.
No real risk in editing this.
http://forums.asp.net/p/890825/1017645.aspx
http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/
Open up the properties on your website, go to the Home Directory tab, and hit Configuration.
Then in there find the .NET mapping, or create a wild card mapping... and make sure the option for 'check file exists' is not checked.
I beleive it happens because IIS6 is unable to hand off requests to ASP.NET when your URLs don't have extensions (like .aspx, for example). In the following sample setup
<add url="~/NewUrl" mappedUrl="~/Default.aspx?UrlId=12345" />
you will get 404 when you try to access http://yousite.name/NewUrl on IIS6. Here's the post in Phil Haack's blog on how to overcome this with wildcard mappings: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
P.S. I know, the post is about ASP.NET MVC, but I think it might help in your scenario too.
精彩评论