![](/img/trans.png)
[英]css and js files not found(server responded with a status of 404) while browsing application on iis7
[英]CSS and Javascripts are not loading when i host application in IIS7
我正在尝试在IIS7中托管asp.net应用程序。 我正在使用应用程序的发布版本。 当我运行它时,所有css和javascript均未加载。 奇怪的是,当我从Visual Studio运行时,它工作正常。
这样的浏览器控制台中的错误: Failed to load resource: the server responded with a status of 404 (Not Found)
经过分析,我发现CSS和JS路径不正确。 您可以在下图中看到。 它是http://localhost/css/bootstrap.css
但应该是http://localhost/MICPA1/css/bootstrap.css
我已经为css和js像MVC使用了bundle。
bundles.Add(new StyleBundle("~/bundles/commonStyle").Include(
"~/css/bootstrap.css",
"~/css/style.css",
"~/css/datepicker.css"
));
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery.min.js"));
bundles.Add(new ScriptBundle("~/bundles/commonJquery").Include(
"~/Scripts/bootstrap.min.js",
"~/Scripts/script.js"));
我也尝试了简单的link
标记,但也无法正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.