i have this weird issue on Win 2k3 server and IIS:

Iis has several sites, in one of them i need to create a subdir and set up it as web application. I've noticed that if i create new directory and put some .js/.txt file into it, they will not be served by iis (IE gives an error Internet Explorer cannot display the webpage).

If i put the same files in another old site's subdirectory it will show correctly.

By sniffing traffic i've seen that iis reply connection state 200 and then drop completely any connection


GET /test2/prova.txt HTTP/1.1
Host: domain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK

If i rename file prova.txt in prova.asp for example it showing without problems so it shouldn't be permissions issue.

After making some researches I've found out that it can be caused by missing mime types, I've checked out .txt and .js are present and served by aspnet_isapi.dll. And here comes another weird thing: if i remove mime mapping from directory's properties it's served correctly, but the same thing doesn't work with js.

I'm really beginning to be out of ideas, is there someone who have some hint?

Thanks in advance.


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

The same can also be done in your web.config file if you are creating a .NET application.

| improve this answer | |

Since you've mapped those extensions to aspnet_isapi.dll, you now need to tell ASP.NET to handle them. You did the IIS part correctly.

It's a PageHandlerFactory that you need to set in your httpHandlers. I found this page that covers it in depth:http://aspnet.4guysfromrolla.com/articles/011404-1.aspx.

| improve this answer | |
  • Probably i explained myself a bit badly. I don't really care if these files are rendered through aspx o served as static content as long as they are downloadable by browser. In another old subfolder of the site (on the same root level) everything is working fine, and 2 folders configs are equal (and web.config doesn't contain specifics to add httphandlers for js/css/other static files) – Alekc Jan 20 '10 at 16:15
  • In that case, it may be because of the aspnet_isapi.dll mapping that you mentioned in your original post. Just remove the mapping for .txt and .js if you don't purposefully need asp.net to handle it. That way IIS will just serve it up as static content. – Scott Forsyth - MVP Jan 21 '10 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.