不會每次都創建新的實例。創建一個實例,並使用它。
//don't this
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.TraceInformation("WorkerRole1 entry point called", "Information");
while (true)
{
QueueClient Client = new QueueClient();
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
}
}
}
//use this
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.TraceInformation("WorkerRole1 entry point called", "Information");
QueueClient client = new QueueClient();
while (true)
{
//client....
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
}
}
}
奇怪 - 這就是他們如何開箱即用+這個評論......所以我猜我很好。謝謝。 – developer82