Css 在Visual Studio Development Server中显示的图像,但不是IIS7
在将MVC5项目发布到IIS 7时,我在使图像正常工作方面遇到了一些问题。我有一个像下面这样的身体风格,它似乎是失败的,因为它显示了一个白色的背景,而不是图像(它完全跳过了灰色) 我启动了chrome开发工具,查看了图像的实际链接,手动添加了一个“/”,然后将其删除,图像显示良好,但刷新失败。除了下面定义的404错误之外,我在控制台中没有收到任何错误 我还尝试了以下版本(其中一些版本比其他版本更明显地失败)Css 在Visual Studio Development Server中显示的图像,但不是IIS7,css,asp.net-mvc,image,visual-studio-2012,iis-7,Css,Asp.net Mvc,Image,Visual Studio 2012,Iis 7,在将MVC5项目发布到IIS 7时,我在使图像正常工作方面遇到了一些问题。我有一个像下面这样的身体风格,它似乎是失败的,因为它显示了一个白色的背景,而不是图像(它完全跳过了灰色) 我启动了chrome开发工具,查看了图像的实际链接,手动添加了一个“/”,然后将其删除,图像显示良好,但刷新失败。除了下面定义的404错误之外,我在控制台中没有收到任何错误 我还尝试了以下版本(其中一些版本比其他版本更明显地失败) Images/Background.png(无错误) /Images/Backgrou
- Images/Background.png(无错误)
- /Images/Background.png(404错误)
- ~/Images/Background.png(404错误)
- ~Images/Background.png(404错误)
- http://10.96.90.65/Images/Background.png 404 (Not Found)
- http://10.96.90.65/SITE/Content/~/Images/Background.png 404 (Not Found)
- http://10.96.90.65/SITE/Content/~Images/Background.png 404 (Not Found)
我适用的虚拟文件结构如下所示
- /内容
- /内容/图像/
- /内容/主题/
- /Content/*.css
- /图像/
<base href="~/" />
否则,您能告诉我们以下选项在IIS服务器上的实际位置吗
- Images/Background.png(无错误)
- /Images/Background.png(404错误)
- ~/Images/Background.png(404错误)
- ~Images/Background.png(404错误)
<base href="~/" />