0

我想为我的天蓝色存储实例设置 DefaultServiceVersion,所以我编写了以下代码:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("CloudStorageConnectionString"));

CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
var serviceProperties = blobClient.GetServiceProperties();
if (serviceProperties.DefaultServiceVersion != "2011-08-18")
{
    serviceProperties.DefaultServiceVersion = "2011-08-18";
    blobClient.SetServiceProperties(serviceProperties);
}

然后我尝试使用开发存储服务器运行它,并从blobClient.GetServiceProperties()

Microsoft.WindowsAzure.StorageClient.StorageServerException was unhandled by user code
  HResult=-2146233088
  Message=Server encountered an internal error. Please try again after some time.
  Source=Microsoft.WindowsAzure.StorageClient
  StackTrace:
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
       at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry[T](Func`2 impl, RetryPolicy policy)
       at Microsoft.WindowsAzure.StorageClient.CloudBlobClient.GetServiceProperties()
       at ConsoleApp.GetContainer() in c:\app\Program.cs:line 90
       at ConsoleApp.Main() in c:\app\Program.cs:line 47
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
  InnerException: System.Net.WebException
       HResult=-2146233079
       Message=The remote server returned an error: (500) Internal Server Error.
       Source=System
       StackTrace:
            at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at Microsoft.WindowsAzure.StorageClient.EventHelper.ProcessWebResponse(WebRequest req, IAsyncResult asyncResult, EventHandler`1 handler, Object sender)
       InnerException: 

是否可以使用开发服务器设置 DefualtServiceVersion?我没有尝试过真实的东西,因为我真的只想测试这是否解决了我遇到的另一个问题。

4

1 回答 1

2

根据此处的文档:http: //msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.storage.blob.cloudblobclient.getserviceproperties.aspx(向下滚动到“备注”部分),此操作是当前不支持本地存储。也不SetServiceProperties支持启用/禁用存储分析的操作。

于 2013-09-05T07:08:38.323 回答