4
votes

I've deployed a small web app which was written in ASP.Net MVC 4. We have our JS/CSS bundles setup properly and they work fine locally. The problem is when I deploy to an IIS 6 server the bundles don't seem to work. The js/css doesn't download and when I try to go to the js link in the script I get a 404.

Has anyone deployed MVC 4 to IIS 6 and had this work?

3
I'd imagine this would be a routing issue, I believe you have to make changes to the routing setup to run MVC on IIS6, I'm afraid I don't have the details to hand though :( - dougajmcdonald

3 Answers

3
votes

The problem was that we were running as a Virtual Directory configured for ASP.Net 4.0 under a Default Web Site which was configured for ASP.Net 2.0.

We created a new web site and set it to asp.net 4.0 and everything worked perfectly. As per this post on Haacked extensionless urls should just work on most instances of IIS 6 now.

2
votes

The bundles are served through extensionless urls like:

IIS 6 does not support extensionless urls out-of-the box. When it encounters an url ending with /js or /css it has strictly no clue that it has to associate this url with the aspnet_isapi.dll handler (ASP.NET).

You may read Phil Haack's blog post in which he explains how you could configure IIS 6 for ASP.NET MVC in order to enable extensionless urls. It's about ASP.NET MVC 3, but exactly the same stands true for ASP.NET MVC 4.

Oh, and you might consider upgrading to IIS 7.0+ which has this feature by default when running in integrated pipeline mode.

0
votes

Mine problem was in BundleConfig.cs file in App_Start. My BindleConfig.cs file was looking previously like following

  bundles.Add(new ScriptBundle("~/Scripts/ui-js").Include(
                                     "~/Scripts/ui-js/jquery.min.1.11.1.js"
                                     , "~/Scripts/ui-js/bootstrap.min.js"
                                     , "~/Scripts/ui-js/bootstrap-slider.js"
                                     , "~/Scripts/ui-js/bootstrap-lightbox.js"
                                     , "~/Scripts/ui-js/common-script.js"
                                     , "~/Scripts/ui-js/html5.js"
                                     , "~/Scripts/ui-js/jquery.colorbox.js"
                                     , "~/Scripts/ui-js/respond.src.js"
                                     , "~/Scripts/ui-js/angular.min.js"
                                     , "~/Scripts/ui-js/bootstrap.js"
                                     ,"~/Scripts/ui-js/jRate.min.js"
                                     , "~/Scripts/ui-js/jcrop.min.js"
                                     ));

And my Layout page had

@Scripts.Render("~/Scripts/ui-js")

After googling i found the solution as you cant use same folder structure for new ScriptBundle() virtual path.

So i changed above to this

bundles.Add(new ScriptBundle("~/Scripts/ppScript").Include(
                                     "~/Scripts/ui-js/jquery.min.1.11.1.js"
                                     , "~/Scripts/ui-js/bootstrap.min.js"
                                     , "~/Scripts/ui-js/bootstrap-slider.js"
                                     , "~/Scripts/ui-js/bootstrap-lightbox.js"
                                     , "~/Scripts/ui-js/common-script.js"
                                     , "~/Scripts/ui-js/html5.js"
                                     , "~/Scripts/ui-js/jquery.colorbox.js"
                                     , "~/Scripts/ui-js/respond.src.js"
                                     , "~/Scripts/ui-js/angular.min.js"
                                     , "~/Scripts/ui-js/bootstrap.js"
                                     ,"~/Scripts/ui-js/jRate.min.js"
                                     , "~/Scripts/ui-js/jcrop.min.js"
                                     ));

And in my Layout page i called it as

@Scripts.Render("~/Scripts/uiScript")

NOTE: You need to do this same with your CSS and modernizr bundle too :)