Assembly.LoadFrom() permissioning in .NET 4.0

4

I am having trouble with security while migrating an application from .NET 3.5 to 4.0.

I have an application that starts successfully from a network share I've mapped to z: - Z:\MyApp\App.exe.

This application makes use of add-ins, and is sometimes asked to load assemblies from a seperate location on the Intranet - y:\MyLib\Lib.dll

In .NET 4.0, I get a System.Security.Security exception then this happens:

System.IO.FileLoadException: Could not load file or assembly 'XXXX' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

However, if I launch my application locally from C:\MyApp\App.exe, it is able to successfully load with Assembly.LoadFrom() the addin at y:\MyLib\Lib.dll.

What do I need to do to 'bless' the y:\MyLib location so that apps running from network shares are allowed to execute code from there?

Thanks, Dave

c#
.net
visual-studio-2010
asked on Stack Overflow May 4, 2010 by Dave Moore

1 Answer

0

I had a similar problem, I was able to solve it as is described in my question Structuremap does not load registries when started from Network drive. I hope this solves your problem also.

answered on Stack Overflow Jul 20, 2010 by Ruben • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0