Worker Role not creating model object?
I've gotten my worker role to ...work. Now i'm having one more minor issue.
My worker role access SQL Azure through the Entity Framework. I'm tring to create a list of populated Email objects from my database and then send those emails. The code works fine locally, but throws exceptions when deployed in the cloud.
To Clarfiy: The worker role IS in a 'Ready' State and when it reaches the problematic piece of code, it causes an excpetion and breaks into a catch block and continues to execute code.
It's only when I try to create my email object:
eg.
Entities entities = new Entities(); //Entities being the name of my DB Model
List emailList = entities.Email.where(x => x.sent == 0).toList(); //creating my list of entities
I've been looking through the intellitrace logs from the Azure deployment (in vs2010) and I'm noticing that I'm getting a "System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types" when my worker role attempts to populate a list with the above code. Looking at the call stack, it points to the Email Model.
I have my webrole working perfectly when deployed with the same code.In addition, I include a referance to my web role in my worker role and it's copy local proper开发者_如何学Pythonty IS set to true.
Any ideas!?
One of the common problems with Azure is that the deployment does not copy some dlls unless they are marked with "CopyLocal" within the Worker Role and/or Web Role. All Dlls absent from GAC of Azure OS should be present.
Article with more details
I've been bitten by that a couple of times myself.
精彩评论