[英]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. 当我将.NET 2.0网站放在IIS 6上时,我遇到了问题。我使用UrlMapping重定向了一些旧的url。 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.
当我在VS本地服务器端口上使用它时,它工作正常,但是当我将其部署到IIS 6时,它给出了404 Page not found错误。
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 modification on IIS Level (if there are any?)
除此之外,在IIS级别上进行此类修改有什么安全风险(如果有的话)?
Thanks in advance, Cheers :) 在此先感谢,干杯:)
Crack open IIS on the target server. 在目标服务器上破解IIS 。
Go to your Web Application , right-click and select Properties 转到您的Web应用程序 ,右键单击并选择“ 属性”。
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. 可能导致您的问题的原因是,在IIS上的ASP.NET映射中,有一个复选框“检查文件是否存在”,取消选中该复选框,您就可以了。
No real risk in editing this. 编辑此文档没有真正的风险。
http://forums.asp.net/p/890825/1017645.aspx http://forums.asp.net/p/890825/1017645.aspx
http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/ 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. 然后在其中找到.NET映射,或创建通配符映射...,并确保未选中“检查文件存在”选项。
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). 我相信这是因为您的URL没有扩展名(例如,.aspx)时,IIS6无法将请求切换到ASP.NET。 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. 当您尝试在IIS6上访问http://yousite.name/NewUrl时,您会得到404。 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
这是Phil Haack博客中有关如何使用通配符映射克服此问题的文章: http : //haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
PS I know, the post is about ASP.NET MVC, but I think it might help in your scenario too. PS我知道,该帖子是有关ASP.NET MVC的,但我认为它也可能对您的情况有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.