简体   繁体   中英

Asp and IIS issues

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"

ie just changing "/Content" to "Content" makes everything works as expected

any thoughts ? !

See MVC 4 Bundle - unable to bundle content eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM