IIS: Can browse to a file, but receive 404 when clicked on to download
I have setup an IIS 6 server to act as a file server. For some of the files, though, clients receive a 404 error.
To diagnose the issue, I enabled directory browsing. I can browse directly to one of the files in question, click on the file, and get the 404.
The website is configured for basic authentication. I verified that the user in question has read permission at the file system level for the desired file.
The IIS log entries for that file access attempt are:
2009-10-26 23:23:38 W3SVC882002786 192.168.1.10 GET /path/to/myfile.war-0.2.45.M.war - 8889 - 72.162.134.92 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US)+AppleWebKit/532.0+(KHTML,+like+Gecko)+Chrome/3.0.195.27+Safari/532.0 401 2 2148074254
2009-10-26 23:23:38 W3SVC882002786 192.168.1.10 GET /path/to/myfile.war-0.2.45.M.war - 8889 - 72.162.134.92 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US)+AppleWebKit/532.0+(KHTML,+like+Gecko)+Chrome/3.0.195.27+Safari/532.0 401 1 0
2009-10-26 23:23:38 W3SVC882002786 192.168.1.10 GET /path/to/myfile.war-0.2.45.M.war - 8889 MYDOMAIN\myuser 72.162.134.92 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US)+AppleWebKit/532.0+(KHTML,+like+Gecko)+Chrome/3.0.195.27+Safari/532.0 404 3 50
So it looks like there are two 401 (access denied) followed by a 404.
Interestingly, .jar files in the same directory can be accessed and downloaded.
Is there somewhere I need to configure IIS to allow other file types to be downloaded?
What is probably happening is that your server doesn't know that .war is a type of file that needs to be downloaded rather than executed. It then is run through your allowed Web Service Extensions for any matches. If it doesn't find one, it throws a 404 error even though the file does in fact exist.
If you set a MIME type for war files of type application/octet-stream, that should resolve your issue.