Any opinions expressed here are my own and not necessarily those of my employer (I'm self-employed).

May 17, 2011

Serving pac files from IIS

IIS refuses to serve static files that cannot be mapped to a particular MIME type. Since I'm a Windows n00b I spent some time figuring this out for myself. Here's what happened, and how to deal with it.

I tried to serve a proxy.pac file from the IIS on my localhost (IIS 7.5/Windows 7), to test some changes to a proxy auto-configuration script. IIS gave me a 404 error instead of serving the file. After fiddling about with various security settings for quite some time, I was eventually able to figure out the problem. If IIS lacks a configured MIME type for a file then it will refuse to serve it — returning a 404 error instead. I suspected MIME types could have something to do with it after I found out that IIS happily served the file as a regular text file if the file was named proxy.txt. As always with Microsoft, when you've successfully pinpointed the problem yourself, you're finally able to launch a Google search that reveals something useful...

Turns out it's all documented, e.g. in the article with the catchy title: Error message when users visit a Web site that is hosted on a server that is running Internet Information Services 7.0: "HTTP Error 404.3 - Not Found". Note, Microsoft states that users visiting the web site will get an error message indicating that the problem is caused by the missing MIME map policy. For the record, I've tested multiple browsers, IE9, FF4,Chrome, Opera. Neither showed a useful error page, so IIS 7.5 does not serve such a page by default.

So, the file exists and you get the generic 404. How can you verify the problem? If you look in the IIS log file you'll see something similar to this (I've truncated the user agent):
GET /proxyx.pac - 8000 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;.....) 404 3 50 1
Note the status codes: 404 3. These are the clues Microsoft has left for you on your quest to serve a static file from IIS. That's unless you, like me, find that you do not have any log files. In that case you should check out my latest post: Enabling IIS log files on Windows 7.

Fortunately, the problem is easily fixed. To add a MIME type for the proxy.pac go to the IIS Manager and select the website. On the settings screen, you'll see the "MIME Types" in the IIS section. There you can "Add.." new MIME types.

According to Wikipedia, there are two MIME types in use for PAC files. I used the newer of the two: application/x-javascript-config.

That's it. IIS should now serve the file, with the correct MIME-type.


  1. Thanks - I was really puzzled by this error and even trying a new virtual website serving just this one file had no effect.

  2. Thanks, helped me lot.

  3. Microsoft has recently released the most stable and efficient windows series , windows 10 is the most stable and updated window with all the needed features. Cortana has been introduced as the windows 10 feature, this works as an assistant for the user.

  4. Smartphones are very important in modern world. Cause you can find everything you want in the Internet. For me it was very helpful when I had to write my college admission essay. I used https://essay4today.com/blog/college-admission-essay to read interesting info about writing.

  5. Many time students believe that just by saying 'do my coursework for me' and paying a certain amount will make them relieved of all the tensions related to their coursework and academia https://manyessays.com/.

  6. Hey! I have found one cool writing service that helped a lot with the writing papers. This servie offer help with the wiritng papers and also it is possible to buy expository essay online

  7. This information is very useful for online business owners, and they can improve their business in very short time. This is a positive step towards success in online marketplace. Dissertation proposal writing services.

  8. The comment hope so useful as in case of using the quickbooks for the accounting thus while facing any installation issue it can be resolved by the quicbooks update error as it has reinstallation system which fix server error

  9. Quickbooks error 15215 server not responding occurs when you are downloading payroll update or when there is conflict with another application which are running in the background. There are many symptoms of this error like - error 15215 occurs and it crashes the active application window, your desktop corrupt very frequently when running the same program, your desktop freezes for a few seconds at a time, etc.

  10. If you’ll notice an error message on your screen that says: “quickbooks error 6144 82 QuickBooks has encountered a problem and needs to close. We are sorry for the inconvenience.” then without wasting time visit the mentioned site and solve your problem


  11. Switching to multi-user mode will resolve QuickBooks error H202 and restore multi-user access that was inhibited by the error. A solution to this issue can only be found by acknowledging all the relevant factors and symptoms. The steps to fix this issue are outlined in detail in this step-by-step guide

    Step To Fix Quickbooks Error h202?

    1- Remove and Recreate the Network Data (.ND) File

    2- Access the QuickBooks Database Server Manager Via the Tool Hub

    3- Host Your Self Network

    4- Resolve the Hosting to Local Files

  12. This series indicates a problem with your file and requires troubleshooting. QuickBooks File Doctor scans your company file and automatically removes any corruption from it. In addition, it also treats a lot of other issues

  13. Great Blog!I have go through all the content of this blog.This is really helpful and informative for me and all the readers.We are providing an online
    men shopping online collection at an affordable and reasonable price.

  14. In a previous article, I described the process of mapping an ASP.NET application to a particular MIME type. In that article, I explained that by default IIS will serve static files using the file extension .aspx . However, if the file cannot be mapped to any specific MIME type (for example, if it is PDF or JPG), then IIS will instead refuse to serve it.

  15. pop over to this website dolabuy.ru go to the website Ysl replica my review here replica bags


Copyright notice

© André N. Klingsheim and www.dotnetnoob.com, 2009-2018. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to André N. Klingsheim and www.dotnetnoob.com with appropriate and specific direction to the original content.

Read other popular posts