question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<handlers> section is added to web.config when explicitly removed from source file

See original GitHub issue

The Sdk (or perhaps to me more precise Sdk.Web) is explicitly adding the <handlers> section to web.config even when I have explicitly removed it.

If the project includes a source web.config such as this …

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <aspNetCore stdoutLogEnabled="false" stdoutLogFile=".\logs\aspnetcore-stdout">
    </aspNetCore>
  </system.webServer>
</configuration>

on dotnet publish, the web.config file that appears in published output is …

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule"
          resourceType="Unspecified" />
    </handlers>
    <aspNetCore stdoutLogEnabled="true" stdoutLogFile=".\logs\aspnetcore-stdout" 
          processPath="dotnet" arguments=".\testportable.dll">
    </aspNetCore>
  </system.webServer>
</configuration>

The reason this is a problem is that my app in this case is a subapp, which cannot have a <handlers> section. Every publish, I must manually delete the <handlers> section in the published output web.config.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
guardrexcommented, Dec 14, 2016

Thanks @nil4 👍

Adding …

<IsWebConfigTransformDisabled>True</IsWebConfigTransformDisabled>

… to the <PropertyGroup> stopped the transform, thus it prevented my web.config from being modified and having the <handlers> section added to it.

The only thing devs need to keep in mind is that their web.config will only be moved. Devs will need to set the processPath and arguments manually in their source file prior to publishing/deploying an app.

Use of this property is probably “the answer” to this issue, so I’ll close.

0reactions
nil4commented, Dec 26, 2016

It’s just a quick-and-dirty port of the CodePlex XDT code to .NET core, with known weaknesses around whitespace preservation and missing unit tests (as you can probably tell from the bug you just found 😀). It works well enough for my own needs, and apparently it’s useful for other people too. If there’s a chance to link it from the docs, that would be great. 👍

If (or rather when) you guys get to https://github.com/aspnet/Tooling/issues/780, I would be happy to hand over the ownership of the NuGet package if that’s something you are interested in. I published the first version under a Microsoft.* name without thinking. /cc @sayedihashimi

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET IIS Web.config [Internal Server Error]
I had a problem with runAllManagedModulesForAllRequests, code 0x80070021 and http error 500.19 and managed to solve it.
Read more >
HTTP Error 500.19 - Internal Server Error - Microsoft Q&A
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking...
Read more >
IIS 8 asp.net mvc HTTP Error 500.19
The system.webServer/Handlers section has been locked somewhere else, meaning that you can not override it in the web.config file at the current ...
Read more >
Setting the web.config File - Documentation - Telerik
Configure the mandatory additions, set the control properties, and add optional configurations to the web.config file when working with Telerik UI for ASP....
Read more >
ASP.NET Core IIS InProcess Hosting Issue in .NET Core 3.1
I ran into a nasty issue yesterday related to hosting an ASP.NET Core 3.1 server application in IIS using the default InProcess hosting....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found