[英]Serve root application instead of subfolder
At work we have an ASP.NET MVC application with a 'Notifications' namespace and accompanying folder. 在工作中,我们有一个带有“ Notifications”命名空间和随附文件夹的ASP.NET MVC应用程序。
The problem comes when trying to access /notifications - IIS it tries to serve files out of the notifications folder, instead of invoking the site's default application. 当尝试访问/ notifications时,问题就来了-IIS试图将文件提供到Notifications文件夹之外,而不是调用站点的默认应用程序。
This is not a problem when deploying because the code folders aren't deployed, but during development, IIS sees the folder and tries to serve it. 部署时这不是问题,因为未部署代码文件夹,但是在开发过程中,IIS会看到该文件夹并尝试为其提供服务。
Does anybody know how to make it just serve the default ASP.NET application for the folder? 有谁知道如何使其仅为该文件夹提供默认的ASP.NET应用程序? The closest I got was setting up a virtual folder, but that doesn't work because of the web.config inheritance behavior. 我最近得到的是建立一个虚拟文件夹,但是由于web.config继承行为而无法正常工作。
I'm afraid the only way to fix this is to rename either your folder or your controller. 恐怕解决此问题的唯一方法是重命名文件夹或控制器。 They can't be the same name because IIS looks inside of the folder first , and then if the folder does not exist, it goes to the ASP.NET ISAPI which then routes it to your controller. 它们的名称不能相同,因为IIS 首先在文件夹中查找, 然后如果该文件夹不存在,它将转到ASP.NET ISAPI,然后将其路由到您的控制器。
Reference: http://forums.asp.net/t/1781586.aspx?+Help+Controller+not+getting+hit 参考: http : //forums.asp.net/t/1781586.aspx?+Help+Controller+not+getting+hit
Sorry :( 对不起:(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.