Net Core sub-application due to configuration causes IIS error 500.19

Source: Internet
Author: User
Tags dotnet

ASP. NET core sub-application causes IIS error 500.19 due to repeated add module in configuration

ASP. NET core is decoupled from IIS and can run as a self-hosted program and no longer relies on IIS.

But we still need powerful IIS as a front-end server, and IIS uses the Httpplatformhandler module to process some Web servers in the background, such as Tomcat, Jetty, Node.exe, Ruby, and of course dotnet, Distribute network requests for their agents at the same time.

Httpplatformhandler are generic, closed-source, and seem to be slow to iterate, Half a year also stay in with a big bug v1.2, probably because of these reasons, the. NET team from the Httpplatformhandler branch out of a specific version of dotnet, renamed to Aspnetcoremodule and ready to open it, so that should be better adapted to. NET The development of core.

If you want to use IIS, then Web. config is required, so we see that the Web. config in the project file is configured like this:

<?xml version= "1.0" encoding= "Utf-8"?><configuration>  <system.webServer>    

Very well understood, <add. /> added a aspnetcoremodule module named "Aspnetcore", followed by <aspnetcore. /> is a simple configuration of the necessary parameters for this module.

This tells IIS to use the Aspnetcore module while the site/application is being processed, and this module will start dotnet and distribute the request.

However, when we add an ASP. NET core sub-application at the site of an ASP.

Accessing this sub-app will get a 500.19 error:

HTTP Error 500.19

Error code: 0X800700B7

Configuration error: Cannot add duplicate collection items of type ' add ' when unique key property ' name ' is set to ' Aspnetcore '

To view the configuration of this sub-application, the System.webserver/handlers node cannot be displayed, and the error is consistent with the configuration error in 500.19:

It is easy to think that the name "Aspnetcore" is already used in the Web. config of the main site, so the sub-application is no longer available.

Try modifying the SUBAPP1 Web. config to change the "Aspnetcore" to another name:

<add name= "aspNetCore123" path= "*" verb= "*" modules= "Aspnetcoremodule" resourcetype= "Unspecified"/>

At this time again visit/subapp1 is all normal.

But this is not the right way to change the name:

Note that this error is a normal behavior for IIS itself, because in the "website" site root directory of Web. config, the <add is already used. /> added the module Aspnetcoremoduel, in the sub-application actually no longer need <add. /> To add this module, but still need the following <aspnetcore. /> To configure the configuration.

So the right thing to do is to keep <add in a site only in the root directory, Web. config. /> Add modules, other sub-applications, all this section is deleted, that is:

<?xml version= "1.0" encoding= "Utf-8"?><configuration>  <system.webServer>        < Aspnetcore processpath= "dotnet" arguments= ". \webapplication6.dll" stdoutlogenabled= "false" stdoutlogfile= ". \logs\ StdOut "forwardwindowsauthtoken=" false "/>  </system.webServer></configuration>

By @calvink, it is more appropriate to delete and add:

<?xml version= "1.0" encoding= "Utf-8"?><configuration>        <system.webServer>       

Net Core sub-application due to configuration causes IIS error 500.19

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.