Using PDFNet on Windows Azure

Q: I am experiencing the following exception when trying to run our
Silverlight Application in the cloud on Windows Azure.

The type initializer for '<Module>' threw an exception. --->
<CrtImplementationDetails>.ModuleLoadException: The C++ module failed
to load while attempting to initialize the default appdomain.
...

I have been using PDFNET successfully when running our Silverlight web
site and associated web services in the following environments:
- Visual Studios ASP.NET Server and services in local console hosts.
- All running on IIS
- All running in Windows Azure Development fabric.
When I deploy both the services and web site to the cloud I receive
the above exception.

In the environment where the problem exists I discovered through trace
statements that I make it to the method that is responsible for
instantiating an object that will end up calling PDFNET.Initialize(…);
That the exception above occurs before I even get into the constructor
of the object that contains the Initialize statement.

I have been able to run with both 32 bit PDFNET dll’s and 64 bit
PDFNET dll’s in environments local to my system. I am fairly certain
the dll is being packaged correctly when deployed to the cloud.

I am hoping that you might have seen this exception before and will
know what typically causes this problem.
-----------------------
A: Most likely the default setting on Azure does not allow mixed
assemblies (or assembles with some native dependencies). In this case
you may need to modify your application policy or settings.

The issue in the following post seems to be fairly similar to yours:
  http://blog.davidsandor.com/post/Solved-The-C2b2b-module-failed-to-load-while-attempting-to-initialize-the-default-appdomain.aspx

The solution was to create a new Application Pool and set the pipeline
mode to ‘Classic’. You may want to check Azure documentation or with
their support team regarding the exact steps in the context of your
application.