Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

http://domain.com/test2/prova.txt

GET /test2/prova.txt HTTP/1.1
Host: domain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) 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.

share|improve this question
    
you can try tracing the request as per the post serverfault.com/questions/121765/…. This will give you better understanding on what the error when .txt file is called. –  Vivek Kumbhar Mar 15 '10 at 4:03
add comment

2 Answers

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

share|improve this answer
add comment

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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