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.
892 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.
|
3月前
|
测试技术
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 的解决办法
127 0
|
8月前
|
网络安全 Docker 容器
failed to create network error response from daemon filed to setup ip tables问题
failed to create network error response from daemon filed to setup ip tables问题
117 0
|
5月前
Error from server error dialing backend remote error tls internal error
Error from server error dialing backend remote error tls internal error
43 0
|
关系型数据库 MySQL Java
解决方案 --Failed to initialize JPA EntityManagerFactory: Unable to create requested service
解决方案 --Failed to initialize JPA EntityManagerFactory: Unable to create requested service
解决方案 --Failed to initialize JPA EntityManagerFactory: Unable to create requested service
Unable to add window --token is not valid
Unable to add window --token is not valid
|
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           ...
1392 0
|
Java 关系型数据库 Oracle
Unable to read additional data from server sessionid
jenkins构建项目报错: Caused by: com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://192.
10391 0