简体   繁体   English

在IIS上找不到UrlMapping并提供404页面,但在本地服务器端口上可以正常工作

[英]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.

相关问题 MVC应用程序在IIS Express中工作正常,但在本地IIS Web服务器中不工作 - MVC Application is working fine in IIS Express but not working in Local IIS web server 当在本地计算机上正常运行时,为什么在IIS 7服务器上找不到类型或名称空间? - Why can't the type or namespace be found on IIS 7 server when it works fine on the local machine? DirectorySearcher 在本地工作但不在 IIS 服务器中工作 - DirectorySearcher working in Local but not working in IIS server global.asax 代码在本地运行良好,但在 IIS 上部署后无法正常运行 - global.asax code working fine in local but not after deploying on IIS Ajax自动完成CSS在iis和服务器上工作正常,但在本地计算机上工作不正常 - Ajax Auto complete Css works fine in iis and the server but not in local machine 不在azure服务器上工作但在本地环境中工作正常吗? - Not working on azure server but works fine in local environment? 在 IIS 7.5 中托管的 Web Api 中找不到 HTTP 404 页面 - HTTP 404 Page Not Found in Web Api hosted in IIS 7.5 css在服务器iis 7上运行不正常,就像本地一样 - css not working well in server iis 7 like on local WCF服务在本地而非服务器IIS上运行以实现功能 - WCF service working on local not server IIS for functions 自托管 ASP.NET Web API 时未找到 404,在 IIS 中工作正常 - 404 not found when self hosting ASP.NET Web API, works fine within IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM