1

When I am trying to deploy an ASP App to IIS, I'm having some serious problems with the scripts and styles.

what i am doing is: first I'm publishing my app using visual studio and then on IIS I'm clicking on a website then deploy and then import an application

The site is working as expected and I am able to access it using the port and URL specified, but I'm losing my css, javascript and jQuery.

some facts:

  1. I am setting debug to false in my Web.config : <compilation debug="false" targetFramework="4.0" />

  2. I installed Microsoft ASP.NET Web Optimization from NuGet to my app

  3. when using firebug or chrome canary to inspect whats happening I can see my links like the following: href="/Content/css/bootstrap.min.css" etc ... when I change it to href=" Content/css/bootstrap.min.css"

i.e just changing "/Content" to "Content" makes everything works as expected

any thoughts ? !

A.Denno
  • 141
  • 2
  • 9
  • Is your application in the root of the website (e.g. `http://servername`), or in a subpath (`http://servername/MyApplication/`)? – CodeCaster Feb 13 '14 at 11:21

1 Answers1

0

See MVC 4 Bundle - unable to bundle content e.g. css/javascript outside MVC project content folder. You can add the bundle using a "CDN path", where you put the proper URL to the bundle:

string cdnPath = "http://yourserver/yourpath/Content/foo.js";
bundles.Add(new ScriptBundle("~/bundles/jquery", cdnPath).Include(

Or take the advice from MVC Bundling and CSS relative URLs:

Don't use bundling on CSS with paths because it is broken except in very simple cases. It's much easier to just directly link minified CSS.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272