Question

I just created a new project in MVC3 using EF4 code first deployed on Windows Azure. I want to keep my "web.config" file as clean as possible because it's a little complicated to understand all tags it contains.

I notice two sections: <system.web> and <system.webServer>

The first is for IIS6 and the second for IIS7+ I do not need backward compatibility so want to delete the first.

I converted a good part of the first into the second, but I cannot find how to convert these sections:

<system.web>
  <authentication mode="None" />
  <compilation debug="true" targetFramework="4.0">
    <assemblies>
      <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral />
      <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral />
      <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral />
      <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral />
    </assemblies>
  </compilation>
  <pages validateRequest="false">
    <namespaces>
      <add namespace="System.Web.Helpers" />
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
      <add namespace="System.Web.WebPages" />
    </namespaces>
  </pages>
</system.web>

How to do this so that I can delete the deprecated <system.web>?

Was it helpful?

Solution

Not all of the elements are deprecated. The two most important sections are /system.web/httpHandlers which has moved to /system.webServer/handlers and /system.web/httpModules which is now /system.webServer/modules. You shouldn't need to touch the above configuration any further as the elements within are still part of the system.web element even in IIS7. Have you tried running your site after your changes?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top