每当我尝试检查队列中是否有任何消息时,我都会收到“对象引用未设置为对象的实例”。我相信可能是因为我的队列过期并关闭了。
msg = this.queue.GetMessage(); 如果(味精!= null)
这是我的天蓝色模拟器错误:
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;
// read storage account configuration settings CloudStorageAccount.SetConfigurationSettingPublisher((configName,
configSetter) => { configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); }); var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
// initialize blob storage CloudBlobClient blobStorage = storageAccount.CreateCloudBlobClient(); this.container = blobStorage.GetContainerReference("userpictures"); // initialize queue storage CloudQueueClient queueStorage = storageAccount.CreateCloudQueueClient(); this.queue = queueStorage.GetQueueReference("pictureminiatures"); this.queue.CreateIfNotExist();
你能帮我找出我在哪里做错了吗?