Question

I have an issue with an open source C++ project that I have been using where when I run it on my development machine (full trust) it works fine. When I deploy it to my hosting environment my site throws the following error:

System.IO.FileLoadException: Unverifiable code failed policy check.

From what I have read this is because my hosting environment runs in medium trust. Are there any settings in the C++ project that I can change to make this dll usable in a medium trust environment?

Update:

After doing some more investigation based on @shf301's answer, I found this quote in the documentation for the project I am working with:

The second project is for .NET developers. I wrote a wrapper in Managed C++ around this C++ project. The result compiles into a .NET DLL.

Doesn't this mean that the code should run in Medium trust?

Was it helpful?

Solution

Is the C++ code managed? Otherwise it's a DLL, not an assembly. An assembly is a .NET concept, it doesn't apply to unmanged DLL's.

If the DLL is unmanaged or it's managed and contains native code, then you can't use it in a medium trust environment.

Your options are to change trust environment you are running or rewriting the library so it is completely managed code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top