IIS 10 上的 403.14 错误 ASP.NET 4.5.2 MVC 应用程序

403.14 Error on IIS 10 ASP.NET 4.5.2 MVC Application

我目前 运行 遇到一个问题几天了,我试图在我的计算机上(并最终在远程服务器上)设置一个非常基本的 MVC 应用程序。但是,我一直 运行 陷入许多问题。

目前,我正在尝试点击 localhost/webapp3,它给我一个 403.14 错误。该应用程序在 Visual Studio 2016 年内在 IIS Express 中运行良好。我禁用了目录浏览,因为我希望我的控制器在该页面显示视图,而不仅仅是列出内容。

我是 IIS 新手,这是我当前的设置:

一些代码(只是我什至没有接触过的预编译代码):

Web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
    <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2" />
        <httpModules>
            <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
        </httpModules>
    </system.web>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
                <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
        </compilers>
    </system.codedom>
</configuration>

HomeController.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebApplication3.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}

我尝试过的事情:

我已经 运行 遇到 403 错误和 404 错误的组合(不确定我的路线是否被接收?)

谢谢!

快速配置与 Internet 信息系统的实际生产配置有很大不同。绑定和权限是大多数问题的根源。要减轻它们,您应该能够执行以下操作。

  1. 停止默认网站。
  2. 创建一个目录,例如 C:/Program Files/Sample Application
  3. 在 IIS 内部,创建一个应用程序池Sample Application确保它默认为 4.0 并集成。
  4. 创建一个站点,指向您的新应用程序池,确保 80 是端口,将底部字段留空(除非您想修改 windows 环回)。
  5. 转到您创建的目录,右键单击顶层添加用户 IIS AppPool/Sample Application
  6. 将应用程序转储到目录中。

如果您在浏览器中键入 localhost,它应该默认为 80 并且应该会点击您的控制器。您可能需要调整您的全局默认路由,以便它命中,但这就是设置服务器所需的全部内容。您的 403.3 授权权限错误应该会消失。

错误基本上是说应用程序池无法读取托管文件的 web.config 文件。