我将ASP.NET MVC 5模板与多页应用程序和EF一起使用,发布并部署到IIS(Win Server 2012)后,我可以成功登录,但是无法加载某些资源(单击F12,然后检查chrome控制台) ):
fontawesome-webfont.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found)
user-img-background.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
fontawesome-webfont.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found)
fontawesome-webfont.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found)
如果F5刷新,则一个错误的详细信息如下: http://xx.xxx.xxx.xxx/Bundles/images/user-img-background.jpg 404(未找到)
启用ASP.NET捆绑包,引用了user-img-background.jpg(项目文件夹/css/style.css):
background:url(“ ../ images / user-img-background.jpg”)不重复不重复;
user-img-background.jpg位于(项目文件夹/images/user-img-background.jpg)中。
BundleConfig如下:
bundles.Add(
new StyleBundle("~/Bundles/account-vendor/css")
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransform())
.Include("~/css/style.css", new CssRewriteUrlTransform())
);
bundles.Add(
new StyleBundle("~/Bundles/vendor/css")
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransform())
.Include("~/css/style.css", new CssRewriteUrlTransform())
);
我还检查了IIS中的MIME类型是否全部添加。
有帮助吗?