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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Nice find. I gave also seen mention of being able to use <customErrors mode="Off" /> for Azure. Surely we can specify IIS specific settings like GZIP compression and the like using the system.webServer section?
You're right, it looks like @Eilon has posted exactly that: stackoverflow.com/a/28729705/195653
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.