简体   繁体   English

服务根应用程序而不是子文件夹

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

相关问题 从子文件夹中的页面访问应用程序根目录中的aspx页面 - access aspx page in application root from a page in subfolder 将根URL调用重写为子文件夹 - Rewrite root url call to subfolder 当MasterPage位于根文件夹中时,在子文件夹中使用JQuery - Using JQuery in a Subfolder When the MasterPage is in the Root Folder 如何告诉IIS使用我的.NET应用程序中的基础catch-all路由从Web根目录提供静态文件? - How do I tell IIS to serve static files from the web root with an underlying catch-all route in my .NET application? 在Web应用程序中为子文件夹设置UICulture - Set UICulture for subfolder in web application 导航到子文件夹而不是正确位置的DataNavigateUrlFields。 - DataNavigateUrlFields navigating to subfolder instead of correct location. 从嵌套母版页重定向使用实际应用程序文件夹而不是根构造URL - Redirect from nested master page contruct a url with actual application folder instead of root 当内容页面不在根文件夹中但在子文件夹中时,样式不会被继承 - styles are not inherited when content page is not in root folder but subfolder 将Webforms页面路由到MVC3应用程序中的子文件夹 - Routing webforms pages to a subfolder in a MVC3 application 在子文件夹上托管ASP.net应用程序 - Hosting an ASP.net application on a subfolder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM