每当我试图检查队列中是否有任何消息时,我得到一个“对象引用没有设置为对象的实例” . 我相信可能是因为我的队列过期而且发生了故障 .
msg = this.queue.GetMessage(); if(msg!= null)
这是我的azure模拟器错误:
Diagnostics]: Error when reading control container:Microsoft.WindowsAzure.StorageClient.StorageClientException: ERROR ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Microsoft.WindowsAzure.StorageClient.EventHelper.ProcessWebResponse(WebRequest req, IAsyncResult asyncResult, EventHandler`1 handler, Object sender)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
at Microsoft.WindowsAzure.Diagnostics.ControlChannel.GetControlContainer()
[Diagnostics]: Polling for configuration changes:System.NullReferenceException: Object reference not set to an instance of an object.
我在OnStart方法上做的是:
ServicePointManager.DefaultConnectionLimit = 12; //读取存储帐户配置设置
CloudStorageAccount.SetConfigurationSettingPublisher((配置名称,
configSetter)=> {configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); }); var storageAccount = CloudStorageAccount.FromConfigurationSetting(“DataConnectionString”); //初始化blob存储
CloudBlobClient blobStorage = storageAccount.CreateCloudBlobClient();
this.container = blobStorage.GetContainerReference(“userpictures”);
//初始化队列存储
CloudQueueClient queueStorage = storageAccount.CreateCloudQueueClient();
this.queue = queueStorage.GetQueueReference(“pictureminiatures”);
this.queue.CreateIfNotExist();
你能帮我看看我做错了什么吗?