IIS 8 asp.net mvc HTTP错误500.19


15

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

IIS Web核心模块

通知BeginRequest

处理程序尚未确定

错误代码0x80070021

配置错误此配置部分无法在此路径上使用。当节锁定在父级时,会发生这种情况。锁定默认情况下是(overrideModeDefault =“ Deny”),或者是由一个带有overlayMode =“ 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>

你有解决过这个吗?我遇到了同样的问题
rik.vanmechelen

Answers:


36

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

原因不是默认的IIS安全策略(存储在中)applicationHost.config,如其他答案所建议(尽管我们已进行了检查)。原因是我们安装的IIS不支持ASP.NET(ASP.NET 4.5角色)!

当我们安装了缺少的对ASP.NET的支持时,我们的应用程序刚启动时根本没有任何配置更改。

结论:

如果收到此错误,请再次检查是否已将ASP.NET角色与IIS一起安装。


要在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

谢谢,很高兴我找到了这个。安装角色服务后,我必须在ISAPI和CGI限制功能中打开ASP.NET v4.0.30319。
cdonner

0

好吧,它告诉您出了什么问题。该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

当我使用appcmd.exe C:\ Windows \ System32 \ inetsrv> appcmd.exe解锁配置“ test.cosplay.dk/app” -sect ion:system.webServer / Handlers ERROR(message:Configuration error文件名:\\?\ C:\ Server \ Kasper \ Web \ test.cosplay.dk \ web.config行号:71说明:无法在此路径上使用此配置节。父级别。默认情况下为锁定(ov errideModeDefault =“ Deny”),或由具有overlayMode =“ Deny”或旧版allowOverride =“ false”。。的位置标记显式设置。)
Androme,2013年

但这是一台全新安装的服务器,这是第一个在其上使用的网站,还有什么其他方法可以锁定handelers?
Androme 2013年

然后删除该Handlers部分。默认情况下可以将其锁定。您是否从Win2008盒中迁移了站点?
Mathias R. Jessen

是的,Win2008R2,如果我删除了handelers,则模块将无法使用mvc!我得到了它接受命令的处理程序,但模块不会遵循:(
Androme
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.