辅助角色不创建模型对象?

发布于 2024-09-09 22:03:05 字数 611 浏览 2 评论 0原文

我已经让我的工人角色......工作了。现在我还有一个小问题。

我的辅助角色通过实体框架访问 SQL Azure。我试图从我的数据库创建一个填充电子邮件对象的列表,然后发送这些电子邮件。代码在本地运行良好,但部署到云端时会抛出异常。

澄清一下:辅助角色处于“就绪”状态,当它到达有问题的代码段时,它会引发异常并中断到 catch 块并继续执行代码。

仅当我尝试创建电子邮件对象时:

例如。

实体实体=新实体(); //实体是我的数据库模型列表的名称

emailList =Entity.Email.where(x => x.sent == 0).toList(); //创建我的实体列表

我一直在查看Azure部署(在vs2010中)的intellitrace日志,我注意到我收到了“System.Reflection.ReflectionTypeLoadException:无法加载一个或多个当我的辅助角色尝试使用上述代码填充列表时,请求类型”。查看调用堆栈,它指向电子邮件模型。

当使用相同的代码部署时,我的 webrole 可以完美工作。此外,我在我的辅助角色中包含了对我的 web 角色的引用,并且它的复制本地属性设置为 true。

有什么想法吗!?

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 property IS set to true.

Any ideas!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷迭香的记忆 2024-09-16 22:03:05

Azure 的常见问题之一是部署不会复制某些 dll,除非它们在辅助角色和/或 Web 角色中标记有“CopyLocal”。 Azure 操作系统的 GAC 中缺少的所有 Dll 都应该存在。

文章更多细节

我自己也被这个问题咬过好几次。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文