IIS配置-ASP.NET MVC对所有请求返回默认文档 [英] IIS configuration - ASP.NET MVC returns default document on all requests

查看:61
本文介绍了IIS配置-ASP.NET MVC对所有请求返回默认文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我有一个在VS 2013中构建的MVC Web应用程序.我已经能够通过IIS在本地计算机上成功托管此应用程序,而没有任何问题.但是,我现在需要在远程计算机上托管.我已经按照在本地计算机上执行的相同步骤进行操作,但是我不断收到错误消息.

Ok so I have an MVC Web application built in VS 2013. I have been able to host this application successfully through IIS on my local machine with no problems. However I now need to host on a remote machine. I have followed the same steps as I did on my local machine but I keep getting errors.

当我尝试浏览Web应用程序时,出现错误HTTP错误403.14-禁止将Web服务器配置为不列出此目录的内容.但是,由于该错误的详细信息告诉我,因此我创建了一个默认文档,现在每次尝试访问该应用程序(localhost/MyWebApp)时,它都会转到该default.html.

When I try to browse the web application i get an error HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. However I have created a default document as the details of this error tell me to and now every time I try to access the application (localhost/MyWebApp) it will just go to that default.html.

但是,当我指定要转到特定的控制器(例如localhost/MyWebApp/Home)时,我会收到404错误(HTTP错误404.0-找不到) 您要查找的资源已被删除,名称已更改或暂时不可用.)

However when I specify that I want to go to a specific controller (e.g. localhost/MyWebApp/Home) I get 404 error (HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.)

由于各种原因,我当前尝试托管的计算机未安装Visual Studio,但是我已经在其上安装了ASP.NET MVC 3和.NET 4.5 Framework.远程计算机IIS上的默认"网站也已经成功运行了classic.net应用.

The machine I am currently trying to host on does not have visual studio installed for various reasons, but I have installed ASP.NET MVC 3 and .NET 4.5 Framework on it. The Default website on the remote machines IIS also already has a classic.net app running successfully.

我的想法是:

1-我缺少托管asp.net mvc应用程序(可能与Visual Studio一起安装的某些程序)所需的一些先决条件

1 - I am missing some pre-requisite needed to host an asp.net mvc application (possibly something that is installed with visual studio)

2-IIS中的某些内容配置不正确.

2 - Something in IIS is incorrectly configured.

任何建议都是值得欢迎的,因为几个小时的闲聊并没有带来任何答案,而且我已经用尽了对IIS的了解

Any advice is welcome as a few hours of goggling has brought up no answers and I have exhausted my knowledge of IIS

修改

已经弄清楚了,并在下面将其标记为答案.

Have figured it out and marked it as an answer below.

推荐答案

我终于通过阅读结果证明,我要做的就是更改Web配置,以便模块部分将runAllManagedModulesForAllRequests设置为true.例如

Turns out all that I needed to do was change the web config so that the modules section has the runAllManagedModulesForAllRequests set to true. e.g.

所以我的网络配置已更改

So my web config changed

发件人:

<system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
</system.webServer>

收件人:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="FormsAuthenticationModule" />
    </modules>
</system.webServer>

这篇关于IIS配置-ASP.NET MVC对所有请求返回默认文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆