0

While developing a ASP.NET MVC4 web application with VS2010, using the Mvc.JQuery.Datatables Nuget, I found that the EmbeddedResourceVirtualPathProvider NuGet that is referenced, worked beautifully on my dev box, but failed miserably on my production box.

The production box is Windows 2003, with IIS6 and .NET 4.0 installed.

I searched many things on SO, and Googling, but after implementing the suggested workarounds, it still fails:

Here's what I've done.

  1. Implement AppInitialize as suggested by https://stackoverflow.com/a/5178993
  2. Implemented Wildcard mapping for ASP.NET as suggested by http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
  3. Implemented IgnoreRoute for static files as suggested by https://stackoverflow.com/a/3144841

but it still doesn't serve all of the files. I'm getting the embedded partial views, but not the embedded css, js, and jpg files.

My web.config has an entry for the StaticFileHandler as follows:

<system.webServer>
  <handlers>
    <add path="*.css" verb="GET" name="Static css" type="System.Web.StaticFileHandler" />
    <add path="*.js" verb="GET" name="Static js" type="System.Web.StaticFileHandler" />
    <add path="*.jpg" verb="GET" name="Static jpg" type="System.Web.StaticFileHandler" />
    <add path="*.gif" verb="GET" name="Static gif" type="System.Web.StaticFileHandler" />
  </handlers>
</system.WebServer>

I appear to be missing something critical. Any Suggestions?

Community
  • 1
  • 1
scott-pascoe
  • 1,463
  • 1
  • 13
  • 31

1 Answers1

0

When using IIS6, all of the items listed in #1-3 are required, but additionally, you need to recognize that IIS6 defines its handlers as httpHandlers in the system.web section, whereas IIS7 calls them handlers and they are in the system.webServer section of the config file.

Therefore, you need to add the following to make it work in IIS6

<system.web>
  ....
  <httpHandlers>
    <add path="*.css" verb="GET" type="System.Web.StaticFileHandler" />
    <add path="*.js" verb="GET" type="System.Web.StaticFileHandler" />
    <add path="*.jpg" verb="GET" type="System.Web.StaticFileHandler" />
    <add path="*.gif" verb="GET" type="System.Web.StaticFileHandler" />
  </httpHandlers>
</system.web>
scott-pascoe
  • 1,463
  • 1
  • 13
  • 31