Call Azure Queue get "The remote server returned an error: (400) Bad Request."

简介: 这几天开始研究Windows Azure, 在使用Azure Queue 的时候,CreateInfNotExists 总是抛出异常 "The remote server returned an error: (400) Bad Request.

这几天开始研究Windows Azure, 在使用Azure Queue 的时候,CreateInfNotExists 总是抛出异常 "The remote server returned an error: (400) Bad Request."

const string RegespStorageConnectionStringKey = "RegespStorageConnectionString";
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(RegespStorageConnectionStringKey));
var queueClient = storageAccount.CreateCloudQueueClient();
var queue = queueClient.GetQueueReference();
queue.CreateIfNotExists();

查了一下,原因尽然是Queue的名字是有要求的:

Queue Names (http://msdn.microsoft.com/en-us/library/windowsazure/dd179349.aspx

Every queue within an account must have a unique name. The queue name must be a valid DNS name, and cannot be changed once created. Queue names must confirm to the following rules:

  1. A queue name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character.
  2. The first and last letters in the queue name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the queue name.
  3. All letters in a queue name must be lowercase.
  4. A queue name must be from 3 through 63 characters long.

注意第三条,所有字母要小写。

把这一句 var queue = queueClient.GetQueueReference(“Regesp”);  改成 var queue = queueClient.GetQueueReference(“regesp”); 就解决问题了。

相关文章
|
Java
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
1150 0
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
【已解决】kex_exchange_identification: Connection closed by remote host fatal: Could not read from
|
8月前
|
应用服务中间件 nginx Windows
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
[emerg] 15060#200: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket ......
234 0
|
8月前
|
测试技术
Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded 的解决办法
Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded 的解决办法
266 0
Error from server error dialing backend remote error tls internal error
Error from server error dialing backend remote error tls internal error
139 0
|
应用服务中间件
Error:Remote staging type or host is not specified.
Error:Remote staging type or host is not specified.
178 0
|
NoSQL MongoDB
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed
1099 0
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed
|
应用服务中间件 nginx
[error] 17755#0: *58522 readv() failed (104: Connection reset by peer) while reading upstream
[error] 17755#0: *58522 readv() failed (104: Connection reset by peer) while reading upstream
5093 0
|
SQL 数据库 Windows
SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)
案例环境:   操作系统: Windows 2003 SE 32bit(SP2) 数据库版本:Microsoft SQL Server 2005 - 9.00.5069.00 (Intel X86)             Aug 22 2012 16:01:52           ...
1426 0

热门文章

最新文章

下一篇
开通oss服务