Windows-Server-2012

IIS 8 asp.net mvc HTTP 錯誤 500.19

  • February 6, 2014

您好,我剛剛為我的 asp.net mvc 框架移動了伺服器。但現在我收到以下錯誤消息,老實說,我現在知道出了什麼問題嗎?

模組 IIS Web 核心

通知開始請求

處理程序尚未確定

錯誤程式碼 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&gt;&lt;/httpModules>
   <httpHandlers&gt;&lt;/httpHandlers>
 &lt;/system.web&gt;
 &lt;system.webServer&gt;
   &lt;httpErrors errorMode="Detailed" /&gt;
   &lt;asp scriptErrorSentToBrowser="true" /&gt;
   &lt;handlers&gt;
     &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt;
     &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt;
     &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
     &lt;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" /&gt;
     &lt;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" /&gt;
     &lt;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" /&gt;
   &lt;/handlers&gt;
   &lt;modules runAllManagedModulesForAllRequests="true"&gt;&lt;/modules&gt;
   &lt;validation validateIntegratedModeConfiguration="false" /&gt;
 &lt;/system.webServer&gt;
 &lt;runtime&gt;
   &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
     &lt;dependentAssembly&gt;
       &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
       &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /&gt;
     &lt;/dependentAssembly&gt;
     &lt;dependentAssembly&gt;
       &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
       &lt;bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /&gt;
     &lt;/dependentAssembly&gt;
     &lt;dependentAssembly&gt;
       &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
       &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /&gt;
     &lt;/dependentAssembly&gt;
     &lt;dependentAssembly&gt;
       &lt;assemblyIdentity name="RouteMagic" publicKeyToken="84b59be021aa4cee" culture="neutral" /&gt;
       &lt;bindingRedirect oldVersion="0.0.0.0-0.2.2.2" newVersion="0.2.2.2" /&gt;
     &lt;/dependentAssembly&gt;
   &lt;/assemblyBinding&gt;
 &lt;/runtime&gt;
 &lt;entityFramework&gt;
   &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
 &lt;/entityFramework&gt;
&lt;/configuration&gt;

我們在全新的伺服器上遇到了同樣的錯誤。

原因不是儲存在 中的預設 IIS 安全策略,applicationHost.config正如另一個答案所建議的那樣(儘管我們檢查過)。原因是我們安裝的 IIS 不支持 ASP.NET(一個 ASP.NET 4.5 角色)!

當我們安裝缺少的對 ASP.NET 的支持時,我們的應用程序剛剛啟動,配置沒有任何變化。

結論:

如果您收到此錯誤,請仔細檢查您是否已隨 IIS 一起安裝了 ASP.NET 角色。


在 Windows Server 中安裝 ASP.NET 角色:

  1. 打開添加角色和功能嚮導
  2. 檢查 ASP.NET$$ your_version $$進入Web Server (IIS)-> Web Server->Application Development

在 Windows 客戶端中安裝 ASP.NET 角色:

  1. 打開打開或關閉 Windows 功能嚮導
  2. 檢查 ASP.NET$$ your_version $$進入Internet Information Services-> World Wide Web Services->Application Development Features

引用自:https://serverfault.com/questions/514091