我在 IIS 7.5/Windows Server 2008 R2 上有 ASP.NET MVC 站点。站点有一组到不同域的 http 绑定(bind),例如 domain1.test.dev.com。 domain2.test.dev.com,总共10个绑定(bind)。他们都过得很好,除了一个。对图像(jpg、gif、png)的每个请求都会为此单个绑定(bind)返回 404。所以整个布局已经加载,所有其他请求感觉良好,但所有图像都被错误 404 Not Found 破坏。没有 https 绑定(bind),它们都使用 http,端口 80 并且 IP 地址是“全部未分配”。 有谁能帮忙吗?
最佳答案
找到了答案。 ~/Images 目录中有一个额外的 web.config 文件。此配置包含其中一个域的特定重定向规则,因此对于这个域,我看到了 404,而其他域工作得很好。一个额外的 web.config 意外地出现在 ~/Images 目录中,因为点击错误 在 IIS 上的 URL 重写模块中。前段时间我们在演示中使用了这样的重定向,之后将其删除。 web.config 中的重定向规则是一种:
<system.webServer>
<rewrite>
<rules>
<rule name="ProductionRedirectDomain1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{CACHE_URL}" pattern="*domain1.test.dev.com*" />
</conditions>
<action type="Redirect" url="{C:1}domain1.com{C:2}" />
</rule>
</rewrite>
</system.webServer>
删除冗余配置后,该错误已消失。谢谢大家!
关于asp.net - IIS 7.5 404 未通过其中一个 http 绑定(bind)找到所有图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48555126/