Error loading dll from an executable on Windows Server 2008


I received an executable which uses .NET to load a dll and perform some database migration tasks. When I tried to run it, I was greeted with the following error:

!!! System.IO.FileLoadException: Could not load file or assembly 'file:///C:\PATH\REDACTED.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\PATH\REDACTED.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See for more information.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

I tried to follow the link in the error message but it was not clear to me where I would set <loadFromRemoteSources>.

Is it a .NET version mismatch thing?

asked on Server Fault Jan 7, 2015 by lmsurprenant

1 Answer


Looks like the error was caused by the dll being blocked by the OS. I fixed the issue by navigating to the dll, going to its properties, and clicking the unblock button.

Hat tip to

answered on Server Fault Jan 7, 2015 by lmsurprenant • edited Apr 13, 2017 by Community

User contributions licensed under CC BY-SA 3.0