简体   繁体   中英

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

I have ASP.NET MVC site on IIS 7.5/Windows Server 2008 R2. Site have a set of http bindings to different domains, such as domain1.test.dev.com. domain2.test.dev.com, 10 bindings in total. They all are doing well, except one. Every request for an image(jpg, gif, png) returns 404 for this single binding. So entire layout has been loaded, all others requests feel good, but all images are broken with error 404 Not Found. There are no https bindings, they all are using http, port 80 and IP Address is 'All Unassigned'. Could anyone help please?

The answer is found. There was an additional web.config file in ~/Images directory. This config contained specific redirection rule for one of the domain, so for this domain I saw 404, and others worked great. An additional web.config appeared in ~/Images directory accidentally, because of missclicking in URL Rewrite module on the IIS. Some time ago we have used such redirections for demo and removed them after that. The redirection rule in web.config was a kind of:

<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>

The bug has disappeared after removing a redundant config. Thanks, everybody!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM