简体   繁体   English

ASP和IIS问题

[英]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. 当我尝试将ASP App部署到IIS时,脚本和样式出现了一些严重问题。

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 我正在做的是:首先,我使用Visual Studio发布我的应用程序,然后在IIS上,我单击一个网站,然后部署并导入一个应用程序

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. 该网站可以正常运行,并且可以使用指定的端口和URL进行访问,但是却丢失了CSS,JavaScript和jQuery。

some facts: 一些事实:

  1. I am setting debug to false in my Web.config : <compilation debug="false" targetFramework="4.0" /> 我在Web.config中将debug设置为false: <compilation debug="false" targetFramework="4.0" />

  2. I installed Microsoft ASP.NET Web Optimization from NuGet to my app 我从NuGet安装了Microsoft ASP.NET Web Optimization到我的应用程序

  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" 当使用firebug或chrome canary检查发生的事情时,我可以看到如下链接: href =“ / Content / css / bootstrap.min.css”等...当我将其更改为href =“ Content / css / bootstrap时.min.css”

ie just changing "/Content" to "Content" makes everything works as expected 即只是将“ / Content”更改为“ Content”,一切都会按预期进行

any thoughts ? 有什么想法吗 ? !

See MVC 4 Bundle - unable to bundle content eg css/javascript outside MVC project content folder . 请参阅MVC 4捆绑包-无法将内容(例如css / javascript)捆绑到MVC项目内容文件夹之外 You can add the bundle using a "CDN path", where you put the proper URL to the bundle: 您可以使用“ CDN路径”添加捆绑,在其中将正确的URL放入捆绑中:

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 : 或从MVC捆绑和CSS相对URL中获取建议:

Don't use bundling on CSS with paths because it is broken except in very simple cases. 不要在带有路径的CSS上使用捆绑,因为除非在非常简单的情况下,否则捆绑会损坏。 It's much easier to just directly link minified CSS. 直接链接最小化的CSS要容易得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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