Azure:无法加载文件或程序集'Microsoft.ServiceBus

发布于 2024-09-25 18:04:54 字数 801 浏览 0 评论 0原文

我有一个想要测试的应用程序结构服务。 (http://xxx.cloudapp.net:8081/service.svc)。< br> 我创建了一个控制台应用程序并向该服务添加了服务引用,但出现以下错误:

无法加载文件或程序集 '微软.ServiceBus, 版本=1.0.0.0,文化=中立, PublicKeyToken=31bf3856ad364e35' 或 它的依赖项之一。系统 找不到指定的文件。

我从 C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Assemblies\NET4.0 添加了对 Microsoft.ServiceBus 的引用,

我将项目中的所有程序集设置为 Copy Local = True,如下所示: http://msdn.microsoft.com/en-us/library/ee706702.aspx :

额外的尽职调查 我在red-gate的反射器中打开Microsoft.ServiceBus并确认它是正确的版本。只是为了好玩,我还添加了对反射器中引用的每个程序集的引用,并将所有引用设置为 copy local = true。

还有其他想法吗?

…彼得

I have a app fabric service that I want to test. (http://xxx.cloudapp.net:8081/service.svc).
I created a console app and added a service reference to the service and got the following error:

Could not load file or assembly
'Microsoft.ServiceBus,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system
cannot find the file specified.

I added a reference to Microsoft.ServiceBus from C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Assemblies\NET4.0

I set all assemblies in my project to Copy Local = True, as suggested here:
http://msdn.microsoft.com/en-us/library/ee706702.aspx

Additional Due diligence:
I opened Microsoft.ServiceBus in red-gate's reflector and confirmed that it is the correct version. Just for kicks, I also added references to each assembly referenced in reflector and set all references to copy local = true.

Any other ideas?

…Peter

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

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

发布评论

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

评论(3

丶情人眼里出诗心の 2024-10-02 18:04:54

确保将目标框架(项目属性/应用程序选项卡)从“.NET Framework 4 Client Profile”更改为“.NET Framework 4”。
我发现了一个类似的帖子,这对我很有帮助。
我相信这与 .NET 4 的客户端配置文件不支持 Microsoft.ServiceBus 有关。

Make sure you change the Target Framework (Project properties/Application tab) from '.NET Framework 4 Client Profile' to '.NET Framework 4'.
I found a similar post and that was what helped me.
I believe it has to with the fact that Microsoft.ServiceBus is not supported by the client profile of .NET 4.

怪我鬧 2024-10-02 18:04:54

当您引用 Microsoft.ServiceBus.dll 时,请从安装位置引用它,例如,

C:\Program Files (x86)\Windows Azure
平台AppFabric
SDK\V1.0\Assemblies\NET4.0\Microsoft.ServiceBus.dll

...不是来自 GAC,并将 Copy Local 设置为 true。

无论您要部署到 Azure 中,您都需要执行此操作; Microsoft.ServiceBus.dll 需要与您的项目打包在一起,因为默认情况下它在 Azure 中不可用。

如果启动 Fiddler,您会在调用该服务时看到 500 错误。这证明异常不在您的调用应用程序中。

When you reference Microsoft.ServiceBus.dll, reference it from the install location, e.g.,

C:\Program Files (x86)\Windows Azure
platform AppFabric
SDK\V1.0\Assemblies\NET4.0\Microsoft.ServiceBus.dll

... not from the GAC, and set Copy Local to true.

You need to do this in whatever you are deploying into Azure; the Microsoft.ServiceBus.dll needs to packaged with your project because it is not available by default in Azure.

If you fire up Fiddler, you see a 500 error when calling the service. This proves that the exception isn't in your calling application.

流绪微梦 2024-10-02 18:04:54

Azure 机器上未安装 ServiceBus dll

  1. 确保对程序集的引用指定 COPY LOCAL
  2. 另外,请确保在不复制本地的上层项目中没有对服务总线 dll 的引用(如果您已验证,这可能是您的问题上面 1)

您可以检查 azure 构建文件夹的 CSX 树,以查看程序集是否被复制到最终包中。这比上传到 azure 或启动开发结构要快得多。

这应该可以解决你的问题

ServiceBus dll is not installed on Azure boxes

  1. Make sure your reference to the assembly specifies COPY LOCAL
  2. Also make sure you don’t have references to the service bus dll in upper projects which do NOT copy local (this might be your problem if you have verified 1 above)

You can check the CSX tree for your azure build folder to see if the assembly is being copied into the final package. That’s a lot quicker than uploading to azure or starting the dev fabric.

That should solve your problem

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