IIS loading image resources fails using non-standard Port


I have a PHP web application hosted in IIS. The problem I have is that some image resources can't be loaded because I'm using a non-standard port 81. But in developer tools I can see that the GET Request using the default port 80.

enter image description here

There are 2 rules already in the web.config but I'm not sure for what purpose.

    <rule name="Imported Rule 1" stopProcessing="true">
        <match url="^.*$" />
        <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}"
                 matchType="IsFile" pattern=""
                 ignoreCase="false" />
            <add input="{REQUEST_FILENAME}"
                 ignoreCase="false" />
        <action type="None" />
    <rule name="Imported Rule 2" stopProcessing="true">
        <match url="^.*$" />
        <action type="Rewrite" url="index.php" />

How can I make this work with any port bound to the webapp?


Here is what I get in the FailedReqLogs:

ModuleName IIS Web Core 
Notification 16 
HttpStatus 404 
HttpReason Not Found 
HttpSubStatus 0 
ErrorCode 2147942402 
ErrorCode The system cannot find the file specified. (0x80070002) 
asked on Server Fault May 26, 2020 by R. Kut • edited May 26, 2020 by R. Kut

1 Answer


Check the code of your HTML.

If it's referencing a FQDN without the extra port added then that will be your problem. You shouldn't hardcode anything

answered on Server Fault May 26, 2020 by jstuart-tech

User contributions licensed under CC BY-SA 3.0