如何在子文件夹中托管ASP.NET MVC站点

gli*_*ran 8 asp.net asp.net-mvc

我正在尝试在我的托管的子文件夹中运行一个小的ASP.NET项目.我的域名是www.gorangligorin.com,但我想在www.gorangligorin.com/testmvc中运行我的应用程序.ASP.NET MVC在顶级运行时没有问题,但在子文件夹中没有运行.

服务器说这个(第58行是红色的):

Line 56:             ASP.NET to identify an incoming user. 
Line 57:     -->
Line 58:     <authentication mode="Forms">
Line 59:       <forms loginUrl="~/Account/LogOn" timeout="2880" />
Line 60:     </authentication>
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能使这个ASP.NET MVC网站有效?这不是托管在我的计算机上,因此我无权访问IIS配置.

vbo*_*can 5

IIS中根应用程序的设置可能会影响您的子应用程序.为了防止根设置传播,请在根web.config中插入以下代码:

<location path="." inheritInChildApplications="false"/>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.


Pbi*_*off 3

您是否在 IIS 中为此目录创建了 ASP.NET 应用程序?否则,ASP.NET 会认为服务器的根目录就是应用程序的根目录,而不是子目录中的根目录。