IIS 8 asp.net mvc HTTP 错误 500.19

IIS 8 asp.net mvc HTTP 错误 500.19

您好,我刚刚为我的 asp.net mvc 框架移动了服务器。但是现在我收到以下错误消息,说实话我现在知道问题出在哪里了吗?

IIS Web Core 模块

通知开始请求

处理程序尚未确定

错误代码 0x80070021

配置错误 此配置部分无法在此路径中使用。当部分在父级锁定时会发生这种情况。锁定是默认的(overrideModeDefault="Deny"),或者通过带有 overrideMode="Deny" 或旧版 allowOverride="false" 的位置标记明确设置。

在此处输入图片描述

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="CosplayConnectionString" connectionString="Data Source=sogaard.us;Initial Catalog=NewCosplay;Integrated Security=False;Persist Security Info=True;User ID=XXXXXX;Password=XXXXXX;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="MaxImageSize" value="5242880" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="RouteDebugger:Enabled" value="true" />
    <add key="RecaptchaPrivateKey" value="6LeAsuASAAAAAKigNk4qtA5iS_E0RPmYTcQM9U4Z" />
    <add key="RecaptchaPublicKey" value="6LeAsuASAAAAAO8HMUg9HKihCMRx0s53Dazbpoag" />
  </appSettings>
  <system.web>
    <customErrors mode="Off" />
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="Recaptcha" />
      </namespaces>
    </pages>
    <profile defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <roleManager defaultProvider="CosplayRoleProvider" enabled="true" cacheRolesInCookie="true">
      <providers>
        <clear />
        <add name="CosplayRoleProvider" type="Sogaard.us.Cosplay.Library.CosplayRoleProvider, Sogaard.us.Cosplay, Version=1.0.0.0, Culture=neutral" connectionStringName="DefaultConnection" applicationname="Cosplay" />
      </providers>
    </roleManager>
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </providers>
    </sessionState>
    <httpModules></httpModules>
    <httpHandlers></httpHandlers>
  </system.web>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <modules runAllManagedModulesForAllRequests="true"></modules>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="RouteMagic" publicKeyToken="84b59be021aa4cee" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-0.2.2.2" newVersion="0.2.2.2" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

答案1

我们在全新的服务器上遇到了同样的错误。

原因不是默认的 IIS 安全策略,存储在 中applicationHost.config,正如所建议的那样另一个答案(尽管我们检查过了)。原因是我们安装的 IIS 不支持 ASP.NET(ASP.NET 4.5 角色)!

当我们安装缺少的 ASP.NET 支持时,我们的应用程序刚刚启动,配置完全没有任何变化。

结论:

如果出现此错误,请仔细检查您是否已与 IIS 一起安装 ASP.NET 角色。


要在 Windows Server 中安装 ASP.NET 角色:

  1. 打开添加角色和功能向导
  2. Web Server (IIS)检查-> Web Server->下的 ASP.NET [your_version] 条目Application Development

要在 Windows 客户端中安装 ASP.NET 角色:

  1. 打开打开或关闭 Windows 功能向导
  2. Internet Information Services检查-> World Wide Web Services->下的 ASP.NET [your_version] 条目Application Development Features

答案2

嗯,它告诉你哪里出了问题。该system.webServer/Handlers部分已被锁定在其他地方,这意味着你无法web.config在当前级别的文件中覆盖它(可能是网站)。

删除:

<handlers>
   <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
   <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
   <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
   <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
   <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
   <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

从你的web.config文件中

或者找出它被锁定的位置并进行更改。
它可能被锁定在applicationHost.config文件中。可以在这里找到它:%windir%\system32\inetsrv\config\。使用文本编辑器打开它并查找类似这样的行

<section name="handlers" overrideModeDefault="Deny" />

将属性更改overrideModeDefault为允许


或者,您可以使用appcmd.exe解锁特定网站或应用程序的部分,如下所示:

appcmd.exe unlock config "WebSiteName/app" -section:system.webServer/Handlers

其中“WebSiteName”是网站的名称,“/app”是应用程序的路径。要为整个网站解锁:

appcmd.exe unlock config "WebSiteName" -section:system.webServer/Handlers

相关内容