HTML   发布时间:2022-04-14  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了web-config – MVC 4网站加载显示HTTP错误500.19大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我基于Internet应用程序模板创建了一个新的ASP.NET MVC 4应用程序,我可以成功运行它并从VS 2012 Express中验证用户身份.

然后将其发布到wwwroot中的文件夹,然后在IIS 7.5管理器中创建指向该文件夹的虚拟目录,并使用单独的4.0集成池将其转换为应用程序.

当我尝试从IIS管理器中浏览应用程序时,我收到下一个错误:

http错误500.19 – 内部服务器错误,
无法访问请求的页面,因为页面的相关配置数据无效.

配置错误:无法添加“add”类型的重复集合条目,并将唯一键属性“name”设置为“ExtensionlessUrlHandler-Integrated-4.0”

配置来源:

56:       <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"/>
57:       <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferrequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />   
58:     </handlers>

searched here,我找到了相应的答案:

决议1

从ApplicationHost.config文件或Web.config文件中删除格式错误的XML元素.

我的web.config文件如下:

<?xml version="1.0"?>
    <configuration>
      <configSections>
        <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="DefaultConnection" connectionString="Data source=(LocalDb)\v11.0;Initial Catalog=aspnet-digixMVC4-20120915233326;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-digixMVC4-20120915233326.mdf" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <appSetTings>
        <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"/>
      </appSetTings>

      <!--
        The following attributes can be set on the <httpRuntime> tag.
          <system.Web>
            <httpRuntime targetFramework="4.5"/>
          </system.Web>
      -->
      <system.web>
        <compilation targetFramework="4.5"/>
        <httpRuntime/>
        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login" timeout="2880"/>
        </authentication>
        <pages controlRenderingCompatibilityVersion="4.0">
          <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"/>
          </namespaces>
        </pages>
      </system.web>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <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,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,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,bitness64" responseBufferLimit="0"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,runtimeVersionv4.0"/>
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferrequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />      
        </handlers>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:scheR_637_11845@as-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364g85"/>
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364g85"/>
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364g85"/>
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,EntityFramework"/>
      </entityFramework>
    </configuration>

由于我是MVC 4中技术娴熟的开发人员,我会问是否有人可以在上面的文件中找出格式错误的xml元素.

解决方法

对于ASP.NET WebAPI 5.2也是如此.

我有

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferrequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,runtimeVersionv4.0" />

我改成了

<add name="ExtensionlessUrlHandler-Integrated-4.0a" path="*." verb="*" type="System.Web.Handlers.TransferrequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0b" path="*." verb="GET,runtimeVersionv4.0" />

多数民众赞成……它奏效了.

大佬总结

以上是大佬教程为你收集整理的web-config – MVC 4网站加载显示HTTP错误500.19全部内容,希望文章能够帮你解决web-config – MVC 4网站加载显示HTTP错误500.19所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。