本文介绍了在部署到云中未能加载文件或程序集Microsoft.WindowsAzure.ServiceRuntime,版本= 1.8.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在本地正常,但当部署到Azure的失败,此消息的MVC 4应用程序:

I have an MVC 4 app that runs fine locally but fails with this message when deployed to Azure:

[FileNotFoundException异常:无法加载文件或程序Microsoft.WindowsAzure.ServiceRuntime,版本= 1.8.0.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。该系统找不到指定的文件。]
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance()+ 0
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor()+ 40

我确信我引用Microsoft.WindowsAzure.ServiceRuntime 1.8版本,并把它设置为本地复制。

I've made sure I referenced Microsoft.WindowsAzure.ServiceRuntime version 1.8 and have it set to copy local.

推荐答案

因此​​,从你的截图它看起来像你创建了一个网站(这是不是一个云服务或Web角色)。大会的 Microsoft.WindowsAzure.Diagnostics Microsoft.WindowsAzure.ServiceRuntime 不能在网站上使用。

So from your screenshot it looks like you created a Web Site (which isn't a Cloud Service or a Web Role). The assemblies Microsoft.WindowsAzure.Diagnostics and Microsoft.WindowsAzure.ServiceRuntime cannot be used in a Web Site.

如果你想创建一个Web角色,打开Visual Studio中>文件>新建项目>云> Windows Azure云服务>添加一个MVC Web角色>确定。一旦您完成后,右键单击该Azure项目,并选择发布。这将允许您创建一个新的云服务将包含您的Web角色。如果你创建你的项目是这样,你将能够使用 Microsoft.WindowsAzure.Diagnostics Microsoft.WindowsAzure.ServiceRuntime 组件。

If you want to create a Web Role, open Visual Studio > File > New Project > Cloud > Windows Azure Cloud Service > Add an MVC Web Role > OK. Once you're done, right click the Azure project and choose Publish. This will allow you to create a new Cloud Service which will contain your Web Role. And if you create your project like this you will be able to use the Microsoft.WindowsAzure.Diagnostics and Microsoft.WindowsAzure.ServiceRuntime assemblies.

这篇关于在部署到云中未能加载文件或程序集Microsoft.WindowsAzure.ServiceRuntime,版本= 1.8.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 07:26