Assembly.LoadFrom () resolves in .NET 4.0

I'm having security issues when migrating an application from .NET 3.5 to 4.0.

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

This application uses add-ons and sometimes it is suggested to load assemblies from a separate place in Intranet - y: \ MyLib \ Lib.dll

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

System.IO.FileLoadException: Failed to load file or assembly "XXXX" or one of its dependencies. A security error has occurred. (Exception from HRESULT: 0x8013150A) ---> System.Security.SecurityException: a request for permission like "System.Security.Permissions.FileIOPermission, mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089" failed.

However, if I run my application locally from C: \ MyApp \ App.exe, it can successfully load from Assembly.LoadFrom () addin in y: \ MyLib \ Lib.dll.

What do I need to do to β€œbless” the y: \ MyLib location so that applications running from network shares can execute code there?

Thanks Dave

+4
source share
1 answer

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

0
source

Source: https://habr.com/ru/post/1308765/


All Articles