对于Azure Compute Emulator中的任何辅助角色,我似乎无法向控制台窗口获取任何输出消息。我正在运行Azure SDK 2.2,并且我从模板创建了一个新的辅助角色,并且没有任何内容正在打印到控制台窗口。我看到的唯一消息是关于布料。
[fabric] Role Instance: deployment22(58).WindowsAzure2.TestWorkerRole.0
[fabric] Role state Started
我已经尝试过Console.WriteLine和Trace.WriteLine,但都无法正常工作。
using System.Linq;
using System.Net;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.Storage;
namespace TestWorkerRole
{
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.TraceInformation("TestWorkerRole entry point called", "Information");
Console.WriteLine("Hello World");
while (true)
{
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
Console.WriteLine("Inside loop");
}
}
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
return base.OnStart();
}
}
}
答案 0 :(得分:6)
事实证明,我必须在安装Azure 2.2 SDK后重新启动计算机。