2

In my app there is a subfolder that contains a Web.config that interferes with my app. E.g. "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level."-type of errors come up.

I can't remove this problematic Web.config because this folder comes from an external source.

Is there any way I can tell IIS to just fully ignore this Web.config?

Piedone
  • 2,693
  • 2
  • 24
  • 43

2 Answers2

1

I got it from somebody expert in the field (among the developers of ASP.NET itself) that this is not possible.

Piedone
  • 2,693
  • 2
  • 24
  • 43
  • I have an npm package that causes the same error, how did you solve the original problem in the end? – Eduardo Wada Sep 03 '18 at 13:03
  • This particular problem I couldn't. It was for an experimental project that was later ditched so it didn't matter. However in the meantime I've heard that putting an empty Web.config will stop IIS serving static files from a folder, even if in the parent folder there is a Web.config configuring StaticFileHandler. So maybe nowadays this works? – Piedone Sep 03 '18 at 17:58
0

In case anyone else comes to this due to an npm package, it's possible to remove the web.config on a postscript using rimraf

npm install rimraf

and then add:

'scripts': {
    'postinstall': 'rimraf node_modules/**/web.config'
 }

on packages.json

In my case, the web.config is in the selenium-webdriver package which is not needed to serve the application so I'm fine with just removing it.

https://stackoverflow.com/a/44863212/1102585

Eduardo Wada
  • 2,606
  • 19
  • 31