Unable to load CSS and images from the Content folder
I have placed CSS and images in the Content folder.
All works fine in VS2010, but when I deployed to IIS 7.5, I am unable to load CSS and image files from the Content folder. But I can load scripts from Content\Scripts. If I put the files in the root folder, however, I am able to access.
I have done the following:
- Make sure IIS has the serve static 开发者_运维知识库content role
- Make sure the mapping for static file exists
- Add the IIS_USR permission to the folder (application and both Content)
- Making sure to use absolute URL i.e.
@<link href = "@Url.Content("~/content/style.css")" rel="stylesheet" type = "text/css" media="screen"/>
Those do not fix the problem.
What else can I do?
try this
<link href="@Url.Content("~/Content/styles.css")" rel="stylesheet" type="text/css" />
It turns out that there was another virtual folder in the site called Content.
We changed the name of the virtual path and the content loaded properly.
精彩评论