Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法加载资源,错误404,正在使用IIS本地服务器运行_C#_Asp.net_Asp.net Mvc_Iis 7 - Fatal编程技术网

C# 无法加载资源,错误404,正在使用IIS本地服务器运行

C# 无法加载资源,错误404,正在使用IIS本地服务器运行,c#,asp.net,asp.net-mvc,iis-7,C#,Asp.net,Asp.net Mvc,Iis 7,早上好,我开发了一个MVC5应用程序,在开发过程中我使用了IIS Express,那里的所有文件都加载得很好,当我上传到我的IIS本地(7)进行测试时,我意识到有几个文件没有加载 Failed to load resource: the server responded with a status of 404 (Not Found) glyphicons-halflings-regular.woff 检查时,我发现文件没有加载,因为实际上,尝试执行GET的路径不正确。它试图走上这条路: ht

早上好,我开发了一个MVC5应用程序,在开发过程中我使用了IIS Express,那里的所有文件都加载得很好,当我上传到我的IIS本地(7)进行测试时,我意识到有几个文件没有加载

Failed to load resource: the server responded with a status of 404 (Not Found)
glyphicons-halflings-regular.woff
检查时,我发现文件没有加载,因为实际上,尝试执行GET的路径不正确。它试图走上这条路:

http://localhost/content/fonts/glyphicons-halflings-regular.woff
但正确的文件应该是:

http://localhost/aprovacoes/content/fonts/glyphicons-halflings-regular.woff
在get中,项目名称丢失,因此未加载

Failed to load resource: the server responded with a status of 404 (Not Found)
glyphicons-halflings-regular.woff
为了解决这个特定源代码的问题,我需要编辑bootstrap.min.css文件并将url从url更改为:

url(/content/fonts/glyphicons-halflings-regular.woff)
为了

然而,在每个项目中都有几个文件没有加载,为了解决这个问题,我正在逐个文件编辑css文件,难道没有其他方法可以在所有css文件中映射这个正确的路径吗


非常感谢您使用资源相对路径。例如,如果您的文件结构如下:

+ bootstrap.css
- fonts
    + glyphicons-halflings-regular.woff
然后,使用URL:
字体/glyph图标halflings regular.woff
。或者如果是这样的话:

- css
    + bootstrap.css
- fonts
    + glyphicons-halflings-regular.woff
然后,您将使用:
。/font/glyph图标halflings regular.woff


这样,只要文件之间的相对路径保持一致,站点的部署方式和位置就无关紧要了。

我觉得奇怪的是,url中需要项目名称,但这取决于iis的设置以及项目的设置和发布方式。如果你可以添加一些可能有用的设置信息。在一些文件中确实工作得很好,但是在css中已经加载的一些URL中,我不得不手动更改,无论如何,我能够更轻松地进行调整,谢谢。