4

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?

1
  • 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 :( Commented Mar 5, 2012 at 17:19

3 Answers 3

3

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.

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

Comments

2

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.

4 Comments

That link assumes you have an extension like .axd which is part of the url. Bundles are truly extensionless though so what he says doesn't work. We already have a Wildcard mapping setup and it's not helping either.
@ShaneCourtrille, unfortunately currently I don't have access to an IIS 6 box in order to test this but I thought that by properly configuring extensionless urls you would be able to achieve that. Maybe you could try asking your question on serverfault.com as your question seems more related to server configuration than programming.
No, just having extensionless doesn't work for me either, unfortunately. I haven't found a solution for this either.
I messed about with this for a while, in the end, I reverted to the old fashioned way...until we upgrade to IIS 7 in work!
0

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 :)

Comments

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.