【发布时间】:2012-09-03 17:19:35
【问题描述】:
我正在以我的辅助角色调用 CloudTableClient.CreateTableIfNotExist 方法,但我遇到了一个内部异常“请求输入之一超出范围”的异常。
我做了一些研究,发现这是由于将表命名为非法表名引起的,但是,我尝试为我的表命名几个不同的名称,但都没有成功。我尝试过的一些表名是:
- 例外情况
- 异常信息
- 错误列表
他们都失败了,出现了同样的错误。
编辑
这是我用来创建表格的代码:
public static void InitializeTableStorage()
{
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(Constants.StorageConnectionString));
// Retrieve storage account from connection-string
// Create the table client
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the table if it doesn't exist
string tableName = ExceptionsTableName;
tableClient.CreateTableIfNotExist(tableName);
}
这是出错的 HTTP 请求:
请求:
GET https://<account>.table.core.windows.net/Tables('exceptioninfo') HTTP/1.1
User-Agent: Microsoft ADO.NET Data Services
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 2.0;NetFx
x-ms-version: 2011-08-18
x-ms-date: Mon, 03 Sep 2012 21:54:20 GMT
Authorization: SharedKeyLite <AccountName>:aBcDeFgAbCdEfGhIjKlMnOpQrStUba+jKlMn/DqrsTu=
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Host: <account>.table.core.windows.net
Connection: Keep-Alive
<account> 全部为小写,<AcountName> 为驼峰式(如果这意味着什么)
回复如下:
HTTP/1.1 400 One of the request inputs is out of range.
Content-Length: 343
Content-Type: application/xml
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: abcdefgh-ijkl-44ed-9ff2-3d07df99c266
Date: Mon, 03 Sep 2012 21:54:03 GMT
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>OutOfRangeInput</code>
<message xml:lang="en-US">One of the request inputs is out of range.
RequestId:abcdefgh-ijkl-44ed-9ff2-3d07df99c266
Time:2012-09-03T21:54:03.6716225Z</message>
</error>
我已经使用同一个 CloudStorageAccount 来创建队列和 Blob,并且成功了。
尝试在 azure 中创建表时是否有任何其他原因导致 OutOfRange 异常?
【问题讨论】:
-
也许运行 Fiddler 跟踪以捕获已进行(和失败)的 REST 调用,并且您可能会在 HTTP 请求中发现一些东西来提示您?
-
您也可以发布您的代码吗?我尝试创建一个名为“exceptions”的表,并且能够使用“CreateTableIfNotExist()”方法创建。
-
我刚刚用我的确切代码和 Fiddler 请求和响应更新了帖子
标签: c# azure azure-worker-roles azure-table-storage