java队列正常关闭_如果队列中没有消息,则Worker Role会关闭

每当我试图检查队列中是否有任何消息时,我得到一个“对象引用没有设置为对象的实例” . 我相信可能是因为我的队列过期而且发生了故障 .

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();

你能帮我看看我做错了什么吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值