Tôi đã tạo ứng dụng ASP.NET MVC 4 mới dựa trên mẫu ứng dụng Internet, tôi có thể chạy thành công và xác thực người dùng từ trong VS 2012 Express.Tải trang web MVC 4 hiển thị Lỗi HTTP 500.19
Sau đó xuất bản nó vào một thư mục trong wwwroot, sau đó trong trình quản lý IIS 7.5 tạo một thư mục ảo trỏ đến thư mục đó và chuyển nó sang ứng dụng bằng cách sử dụng một nhóm tích hợp 4.0 riêng biệt.
Khi tôi đã cố gắng để duyệt qua các ứng dụng từ bên trong quản lý IIS Tôi nhận được lỗi sau:
Lỗi HTTP 500,19 - Internal Server Error, Trang bạn yêu cầu không thể được truy cập bởi vì các dữ liệu cấu hình có liên quan cho trang là không hợp lệ.
Config Lỗi: Không thể thêm vào bộ sưu tập bản sao của loại 'thêm' với 'tên' độc đáo thuộc tính khóa thiết lập để 'ExtensionlessUrlHandler-Tích hợp-4.0'
nguồnConfig:
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, tôi tìm thấy câu trả lời tương ứng:
Nghị quyết 1
Xóa ele XML bị thay đổi từ tệp ApplicationHost.config hoặc từ tệp Web.config.
file web.config của tôi là như sau:
<?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,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"/>
<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:schemas-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>
Như Tôi là một nhà phát triển kém tay nghề cao trong MVC 4, tôi sẽ hỏi nếu ai đó có thể tìm ra các yếu tố xml bị thay đổi trong file trên.
Tôi không thấy cùng một tên hai lần, có mã bưu điện _32bit hoặc _64bit khác nhau. Có phải là ma thuật này bằng cách nào đó không? – qub1n
Sự cố cũng xảy ra với tôi. Tôi cũng có postfix _32bit/_64bit, tuy nhiên việc sửa đổi các chuỗi theo bất kỳ cách nào sẽ giải quyết vấn đề, miễn là cả hai chuỗi đều được sửa đổi. Cả hai có thể có cùng một cơ thể chính xác nhưng giữ nguyên bản gốc _32bit/_64bit postfix và nó vẫn sẽ hoạt động, cho tôi biết rằng nó không phải là * tiền tố ma thuật. Tôi nghi ngờ nó kiểm tra các trận đấu giữa các dự án khác trong giải pháp/trên máy chủ. Điều đó, hoặc một cái gì đó kỳ lạ đang xảy ra trong IIS. – 16807
Đã tìm ra sau khi đọc: http://stackoverflow.com/questions/26271958/what-does-extensionlessurlhandler-do-in-an-mvc-application. Thứ tự của thẻ thêm/xóa dường như quan trọng. Tôi đã thêm ExtensionlessUrlHandlers trước khi loại bỏ các mặc định hiện có được cung cấp bởi IIS. Các giá trị mặc định có cùng tên với các trình xử lý tôi đã thêm vào, do đó có lỗi. – 16807