C# Web 角色部署期间缺少 Microsoft.WindowsAzure.Diagnostics
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11909120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Missing Microsoft.WindowsAzure.Diagnostics during Web Role deployment
提问by Andres Jaan Tack
Using Visual Studio 2012 RC, from the page, I started an Azure Cloud Service. I selected MVC 4, included a test project, and enabled NuGet package restores on build.
使用 Visual Studio 2012 RC,从页面中,我启动了 Azure 云服务。我选择了 MVC 4,包含了一个测试项目,并在构建时启用了 NuGet 包还原。
When I deployed this to an Azure Web Site, using git, it seems that the target box does not include either the WindowsAzure.Diagnosticsorthe WindowsAzure.ServiceRuntimelibraries. I'm new to .NET in general, but I can't imagine what I'm missing here. Furthermore, while I can trivially remove Diagnostics from the references (no diagnostics, no problem), it doesn't seem that I can do the same with ServiceRuntime.
当我部署这蔚蓝的网站,使用Git,似乎目标框不包括任何的WindowsAzure.Diagnostics或在WindowsAzure.ServiceRuntime图书馆。我是 .NET 的新手,但我无法想象我在这里错过了什么。此外,虽然我可以从引用中轻松删除诊断(没有诊断,没问题),但似乎我不能用 ServiceRuntime 做同样的事情。
Am I doing something wrong, or is this a bug in Azure Web Sites? Is it fixable?
我是不是做错了什么,还是 Azure 网站中的错误?可以修复吗?
C:\... [master]> git push azure master
Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (12/12), 216.47 KiB, done.
Total 12 (delta 5), reused 0 (delta 0)
remote: New deployment received.
remote: Updating branch 'master'.
remote: Preparing deployment for commit id '2cb9c59bd0'.
remote: Building web project 'MvcWebRole1.csproj'.
remote: ..
remote: Successfully installed 'Microsoft.AspNet.WebApi 4.0.20505.0'.
remote: Successfully installed 'Microsoft.AspNet.Web.Optimization 1.0.0-beta2'.
remote: Successfully installed 'jQuery.Validation 1.8.1'.
remote: Successfully installed 'Microsoft.AspNet.Razor 2.0.20505.0'.
remote: Successfully installed 'Microsoft.AspNet.Providers.Core 1.0'.
remote: Successfully installed 'Microsoft.AspNet.Providers.LocalDb 1.0'.
remote: Successfully installed 'jQuery.UI.Combined 1.8.11'.
remote: Successfully installed 'jQuery 1.6.2'.
remote: Successfully installed 'Microsoft.AspNet.WebApi.Client 4.0.20505.0'.
remote: Successfully installed 'Microsoft.AspNet.Mvc 4.0.20505.0'.
remote: Successfully installed 'Microsoft.AspNet.WebApi.Core 4.0.20505.0'.
remote: Successfully installed 'Microsoft.AspNet.WebApi.WebHost 4.0.20505.0'.
remote: Successfully installed 'Microsoft.jQuery.Unobtrusive.Ajax 2.0.20505.0'.
remote: Successfully installed 'Microsoft.jQuery.Unobtrusive.Validation 2.0.20505.0'.
remote: Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
remote: Successfully installed 'Microsoft.AspNet.WebPages 2.0.20505.0'.
remote: Successfully installed 'Modernizr 2.0.6'.
remote: Successfully installed 'Microsoft.WindowsAzure.ConfigurationManager 1.7.0.0'.
remote: Successfully installed 'Microsoft.Net.Http 2.0.20505.0'.
remote: Successfully installed 'WebGrease 1.0.0'.
remote: Successfully installed 'EntityFramework 5.0.0-rc'.
remote: Successfully installed 'WindowsAzure.Storage 1.7.0.0'.
remote: Successfully installed 'knockoutjs 2.0.0'.
remote: Successfully installed 'Newtonsoft.Json 4.5.1'.
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resol
ve this reference. Could not locate the assembly "Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your
code, you may get compilation errors. [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRole1
.csproj]
remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resol
ve this reference. Could not locate the assembly "Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutra
l, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by yo
ur code, you may get compilation errors. [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRo
le1.csproj]
remote: WebRole.cs(5,30): error CS0234: The type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\Mv
cWebRole1\MvcWebRole1.csproj]
remote: WebRole.cs(6,30): error CS0234: The type or namespace name 'ServiceRuntime' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\MvcWebRole1.csproj]
remote: WebRole.cs(10,28): error CS0246: The type or namespace name 'RoleEntryPoint' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\barf\VirtualDirectory0\site\repository\MvcWebRole1\Mvc
WebRole1.csproj]
remote:
remote: Error - Changes committed to remote repository but your website not updated.
采纳答案by RajeshKdev
This error you are getting because of assembly reference.
由于程序集引用而导致的此错误。
If installed Microsoft SDK, the references will be there in reference folder.If its not there then we have to browse add into Solution.Even i got the same problem while running the solution.Now i resolved this problem and its working fine.
如果安装了 Microsoft SDK,引用将在引用文件夹中。如果它不存在,那么我们必须浏览添加到解决方案中。即使我在运行解决方案时也遇到了同样的问题。现在我解决了这个问题并且它工作正常。
If we installed windows azure sdk
如果我们安装了 windows azure sdk
"C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\ref"
"C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\ref"
all the references will be here.just add this references in to your solution and build it, will work.
所有引用都将在这里。只需将此引用添加到您的解决方案中并构建它,即可使用。
Hope this may helpful,
希望这可能会有所帮助,
Thanks,
谢谢,
回答by Jennifer Perret
I believe this is because you are using Visual Studio 2012 Release Candidate and the Windows Azure Tools for Visual Studio 2012 have not yet released. Try the same code with Visual Studio 2010 and all your assemblies should be found and issues resolved.
我相信这是因为您使用的是 Visual Studio 2012 Release Candidate 而 Visual Studio 2012 的 Windows Azure 工具尚未发布。使用 Visual Studio 2010 尝试相同的代码,应该会找到所有程序集并解决问题。
回答by Website Samaritan
This question is clearly answered.
这个问题得到了明确的回答。
However, the easiest resolution is to add the AzureSDK2.2DLLsto your web role project(s).
但是,最简单的解决方法是将AzureSDK2.2DLL添加到您的 Web 角色项目中。

