开发者

ReflectionTypeLoadException: Unable to load one or more of the requested types(LoaderExceptions)

开发者 https://www.devze.com 2023-03-19 03:47 出处:网络
I have a problem with my application where I load a l开发者_如何学Goist of assemblies (Assembly.LoadFrom) from a path (\\ \\ RemoteServerDir ...) and when I try to retrieve all types of each assemblie

I have a problem with my application where I load a l开发者_如何学Goist of assemblies (Assembly.LoadFrom) from a path (\ \ RemoteServerDir ...) and when I try to retrieve all types of each assemblies i get errors when calling assembly.GetTypes () method.

The message that i have is "ReflectionTypeLoadException: Unable to load one or more of the Requested types (LoaderExceptions)".

Does someone has an idea to solve this? For information, this application is running in distributed mode who i have this probleme but in local mode it works well.

Thank you.


Most probably it is has to do with different permission level when you loading remote assemplies

Please try replacing Assembly.LoadFrom to Assembly.UnsafeLoadFrom available in C# 4.0 MSDN which will bypass security checks

Old way is to add configuration section

<configuration>
    <runtime>
        <loadFromRemoteSources enabled="true" />
    </runtime>
</configuration>

which will load assembly with full trust

0

精彩评论

暂无评论...
验证码 换一张
取 消