IIS 7.5 not able to server Javascript file, throws 500 error.

iis-7.5javascript

I have a site sitting on IIS 7.5. There are numerous JavaScript files that are being served from a scripts folder. Most of those files are served properly but there is one file that causes IIS to throw a 500 error.

On examining that JavaScript file I can see a warning about the file being from an untrusted source. None of the other JavaScript files show this warning. The file was copied along with the other files from our deployment/QA server where everything worked correctly.

Why is this single file marked as UnTrusted but other files are not? How can I remove that flag so that the file will be served as required?

Best Answer

Select the file in Windows Explorer, and open its properties, on the General tab there is an Unblock button. Click that.

On newer Windows versions you can also use PowerShell:

Unblock-File myfile.js

I am not sure whether this is available on Server 2008 R2