NotFoundMvc icon indicating copy to clipboard operation
NotFoundMvc copied to clipboard

web.config Transformed Incorrectly On Upgrade

Open Gabby-Paolucci opened this issue 8 years ago • 3 comments

When upgrading the package to 1.4.0, my web.config is being transformed incorrectly.

The allow zombie DOS names line had a transform attribute added to it:

<!-- Allow zombie DOS names to be captured by ASP.NET (/con, /com1, /lpt1, /aux, /prt, /nul, etc) --><httpRuntime targetFramework="4.5" maxRequestLength="32768" xdt:Transform="SetAttributes" relaxedUrlToFileSystemMapping="true" />

A second httpRuntime was added right before the closing of system.web, with a transform attribute in it:

<httpRuntime xdt:Transform="InsertIfMissing" relaxedUrlToFileSystemMapping="true" /></system.web>

And though it seems to just be a formatting difference, the httpErrors section was transformed from:

<httpErrors errorMode="Custom">
  <remove statusCode="403" subStatusCode="-1" />
  <error statusCode="403" subStatusCode="-1" path="/error/forbidden" responseMode="ExecuteURL" />
  <!-- Catch IIS 404 error due to paths that exist but shouldn't be served (e.g. /controllers, /global.asax) or IIS request filtering (e.g. bin, web.config, app_code, app_globalresources, app_localresources, app_webreferences, app_data, app_browsers) -->
  <remove statusCode="404" subStatusCode="-1" />
  <error statusCode="404" subStatusCode="-1" path="/notfound" responseMode="ExecuteURL" />
</httpErrors>

To this:

<httpErrors errorMode="Custom">
  <!-- Catch IIS 404 error due to paths that exist but shouldn't be served (e.g. /controllers, /global.asax) or IIS request filtering (e.g. bin, web.config, app_code, app_globalresources, app_localresources, app_webreferences, app_data, app_browsers) --><remove statusCode="403" subStatusCode="-1" />
  <error statusCode="403" subStatusCode="-1" path="/error/forbidden" responseMode="ExecuteURL" />



<remove statusCode="404" subStatusCode="-1" /><error statusCode="404" subStatusCode="-1" path="/notfound" responseMode="ExecuteURL" /></httpErrors>

Gabby-Paolucci avatar Dec 04 '15 15:12 Gabby-Paolucci

How did you solve the latter one?

aboesch avatar Dec 28 '15 08:12 aboesch

For all of these I just reverted the changes made to the web.config file using version control, since nothing seemed to be an actual required change to the file. The upgrade worked fine without the changes to the web.config, so it does seem the changes were unnecessary.

Gabby-Paolucci avatar Dec 28 '15 14:12 Gabby-Paolucci

Installing this fresh, I ultimately had to install version 1.3, then update to 1.4 and do a file compare. I removed all of the mentions of xdt and it's now working. I know just about nothing about XML, but the fact that the xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" line of code references an invalid URL (if you try to navigate to that URL in your web browser, you'll see what I mean) just seems wrong to me. Did Microsoft move that resource or something?

stamminator avatar Aug 05 '16 21:08 stamminator