0
votes

I am building a REST WCF Application in top of Windows Azure. In localhost I am able to connect and use SQL Azure with NHibernate nicely, but whenever I try to move the application to Windows Azure, it cannot load the required DLLs for NHibernate to work properly.

I've seen forums where it says that this problem might occur if the NHibernate DLLs were compiled with x86 target, and since Windows Azure runs on x64, I tried to modify the target of my build to x64 (although I am running Windows 7 x86).

The problem it is displaying is

The server encountered an error processing the request. The exception message is 'Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed. Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll'. See server logs for more details.

Have anyone has seen this error before? How do I solve this?

3
It sounds like you're missing a DLL in the deployment. Does this help? stackoverflow.com/questions/1913504/…Stuart
It is the same problem but I honestly don't know how to check the DLLs that are copied to Azure Storage for deployment.jpabluz

3 Answers

0
votes

Did you set "copy local" in the properties of all referenced assemblies in the project?

0
votes

Since it's the same problem as NHibernate unable to load Proxy Factory, then:

  • check that one of NHibernate.ByteCode.LinFu.dll or NHibernate.ByteCode.Castle.dll are referenced by your project
  • ensure that the "Copy local" is true on that dll
0
votes

Well, it turned out that this didn't had anything to do with Azure, which runs it fairly effortless.

To make this to work I had to hack the msbuild process, who was "smart" enough to leave out the Castle dll. As stated, this should not be a permanent fix, because you will need to modify msbuild configuration so it includes the required dll's. I just don't know how to do that yet, perhaps the geniuses at StackOverflow can help us.

This was the blog post that helped me, sharing with you for future reference:

http://weblogs.asp.net/srkirkland/archive/2009/10.aspx