IIS7 returns 404 on some static files, not others

2019-04-26 20:07发布

问题:

I have a css file and a js file in a directory. The css file returns 200 OK while the js file returns 404 Not Found.

They have the same permissions. IUSR, IIS_IUSRS, Internet Guest Account all have (at least) Read.

回答1:

Add the file type to IIS MIME TYPES. It wont serve unknown file types.



回答2:

Adding the file type to the IIS MIME Types worked for me. Fortunately for caveman-brains like mine, IIS let's you do this with the UI.

From the MS website

To use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
  2. In Features View, double-click MIME Types.
  3. In the Actions pane, click Add.
  4. In the Add MIME Type dialog box, type a file name extension in the File name extension text box. For example, type .xyz
  5. Type a MIME type in the MIME type text box. For example, type 'application/octet-stream'