IIS 7.5 404 未通过其中一个 http 绑定找到所有图像

IIS 7.5 404 not found for all images via one of the http bindings

我在 IIS 7.5/Windows Server 2008 R2 上有 ASP.NET MVC 站点。站点有一组到不同域的 http 绑定,例如 domain1.test.dev.com。 domain2.test.dev.com,一共绑定了10个。他们都过得很好,除了一个。对于此单个绑定,每次请求图像(jpg、gif、png)returns 404。所以整个布局已经加载,所有其他请求感觉良好,但所有图像都被错误 404 Not Found 破坏。没有 https 绑定,它们都使用 http,端口 80,IP 地址是 'All Unassigned'。 有人可以帮忙吗?

找到答案了。 ~/Images 目录中还有一个 web.config 文件。此配置包含其中一个域的特定重定向规则,因此对于这个域,我看到了 404,而其他域工作得很好。额外的 web.config 意外出现在 ~/Images 目录中,因为点击错误 在 URL 重写 IIS 上的模块。前段时间我们在演示中使用了这样的重定向,之后将其删除。 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>

删除冗余配置后该错误已消失。谢谢大家!