Pergunta

By default, ASP.NET splits up your web.config so that razor-related items are included in "~/views/web.config" while everything else is put into "~/web.config".

For me, it would make sense to combine all of it into one so that it would apply to the entire site. Would there be any downside to doing this?

Foi útil?

Solução

As you've seen it's valid to have multiple web.config files in a website, under different folders.

In your main web.config (at the site root), you can specify different configuration at different folders in the site using the <location> element. Having a web.config file in that folder (location) instead has the same effect, so consolidation is possible.

However, I would suggest leaving it be:

  • It's arguably easier to manage this separate configuration which is specific to the view engine being used.
  • Any future maintainers will be familiar to MVC and so expect to see the extra web.config there.
  • The same could be said for any Nuget packages which you may need, that expect it to be there also.

There's bound to be other reasons too, but they come to mind right now.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top