2

An ASP.NET MVC 6 project does not come with a Web.config file by default. However, if you want to use IIS, then you need to add one under the wwwroot folder. There seems to be very little information about running MVC 6 sites under IIS (Which 99% of people would want to do).

  1. How do you go about creating a Debug/Release or in the new world Development/Staging/Production version of the Web.config file.
  2. The appSettings and connectionStrings are now deprecated in favour of the new Configuration model.
  3. Can we still use the settings under system.web like authentication, caching, compilation, customErrors, httpCookies, sessionState and trace?
  4. What about the runtime assemblyBindings's? Do we still need these?
  5. What about HTTP Handlers? In MVC 5, we had to remove the Trace handler in the release build or we got a 500 Internal Server error when navigating to /Trace.axd, instead of 404 Not Found. Do we still need to remove them?
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311

1 Answers1

2

They don't really have the documentation for much of ASP.NET 5 built up, but the instructions for publishing to IIS are fairly clear.

This process generates a very tiny web.config for you. For example:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="bootstrapper-version" value="1.0.0-beta6-11895" />
    <add key="runtime-path" value="..\approot\runtimes" />
    <add key="dnx-version" value="1.0.0-beta6-12005" />
    <add key="dnx-clr" value="clr" />
    <add key="dnx-app-base" value="..\approot\src\Sample" />
  </appSettings>
</configuration>

Other than that, it looks like the system.webServer section will be respected by IIS, including compression and caching.

Community
  • 1
  • 1
Matt DeKrey
  • 11,582
  • 5
  • 54
  • 69
  • Nice find. I gave also seen mention of being able to use `` for Azure. Surely we can specify IIS specific settings like GZIP compression and the like using the system.webServer section? – Muhammad Rehan Saeed Jun 12 '15 at 15:15
  • 1
    You're right, it looks like @Eilon has posted exactly that: http://stackoverflow.com/a/28729705/195653 – Matt DeKrey Jun 12 '15 at 15:19
  • Thanks @MattDeKrey. I can't believe there is no info on this. It is the main use case of ASP.NET MVC 6. I think the first question is still unanswered. – Muhammad Rehan Saeed Jun 12 '15 at 15:28