- 語言:C#
- 框架:.NET 4.5
- 的NuGet:WindowsAzure.Storage 8.0.1版
嗨。Microsoft.WindowsAzure.Storage.StorageException - 服務器忙
我看到Microsoft.WindowsAzure.Storage.StorageException
在生產站點的日誌中不時地告訴我「服務器正忙」。有沒有人有任何經驗或專業提示如何擺脫這種行爲。我應該改變Azure Portal中的某些設置還是使用我的代碼做些什麼?
當下例中的public static IEnumerable<MessageEntity> Get(string sentTo)
被調用時發生錯誤。
代碼:
private static CloudTable GetMessageTable()
{
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
var tableClient = storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference(CloudConfigurationManager.GetSetting("MessageTable"));
try
{
if (!table.Exists())
table.Create();
}
catch (Exception e)
{
// Log err
}
return table;
}
public static IEnumerable<MessageEntity> Get(string sentTo)
{
var table = GetMessageTable();
var query = new TableQuery<MessageEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, sentTo));
var result = table.ExecuteQuery(query);
return result.OrderByDescending(r => r.SentDate);
}
登錄:
Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (503) Server Unavailable. ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 677
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 604
at Microsoft.WindowsAzure.Storage.Table.TableQuery`1.<>c__DisplayClass7.<ExecuteInternal>b__6(IContinuationToken continuationToken) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\TableQuery.cs:line 430
at Microsoft.WindowsAzure.Storage.Core.Util.CommonUtility.<LazyEnumerable>d__0`1.MoveNext() in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\Common\Core\Util\CommonUtility.cs:line 322
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source, Func`2 predicate)
at *** removed ***
Request Information
RequestID:*** removed ***
RequestDate:Tue, 11 Apr 2017 15:30:30 GMT
StatusMessage:Service Unavailable
ErrorCode:ServerBusy
ErrorMessage:The server is busy.
RequestId:*** removed ***
Time:2017-04-11T15:30:31.0229653Z