IIS Can't Serve Certain File Extension
By default, IIS in W2K3 and above won't serve files that aren't of a MIME type that it knows about (instead returning 404 errors).
You need to add a MIME type to IIS to allow it to serve that type of file. You can set it at the site level or at the server level.
To set this for the entire server:
- Open the properties for the server in IIS Manager and click MIME Types
- Click "New". Enter "JSON" for the extension and "application/json" for the MIME type.
I had the same problem. IIS does something called MIME type filtering. If it dosn't know a specific file extension's MIME type, it returns a 404 error.
On IIS <7: Open the site (or server) properties. Click on the HTTP-Header tab. Click on the MIME Types button. Add the file type * with the MIME type "application/octet-stream".
For IIS 7: Open IIS manager. Click the server or website. Double-click the MIME Types feature icon. In the Actions pane, click Add. Populate the "File Name Extension" box with * and the MIME Type box with "application/octet-stream".
I added MIME type .json
- text/json
to the site in IIS to view in browser as text.
To consolidate answers into one more general answer:
-
IIS won't serve files that don't have a MIME type associated with them
- See: IIS 6.0 will not serve unknown MIME types
- And: Configuring MIME types in IIS 7
Here comes the caveat:
-
Unless a script handler (active content engine, eg, ASP/ASPX/PHP/Java/ISAPI/etc) is associated with them
- this means that IIS treats them as active content, not static files
- Active content files served by any extension must have that extension allowed in the Web Service Extensions restriction list (aka ISAPI/CGI restrictions in IIS 7)
- if you're getting a 404 on an active content type in IIS 7, it may also mean your handler is not installed - so you need to actually go install the component that supports that file extension (for example, if .aspx files generate a 404, you probably don't have ASP.Net installed)
If you're experiencing this sort of problem, open up the website's web log files, and have a look at the sub-status code (i.e. 404 3) to determine exactly why your website isn't serving content for IIS 6, or
- use Failed Request Tracing
- (or just the detailed errors on the local console)
in IIS 7.