0

どんな助けでも大歓迎です。

1.6 SDK for Azure Storage Tables を使用しています。UpdateObject() で、次のエラーが発生します。

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code>InvalidInput</code>
  <message xml:lang="en-US">One of the request inputs is not valid.
RequestId:b78bc343-f93c-4ec7-8991-24386131de43
Time:2012-08-08T01:25:32.4366914Z</message>
</error>

リクエストは次のとおりです(Fiddlerから取得):

MERGE https://foo.table.core.windows.net/foo('87a23657-9206-4450-a7ca-09d599b41b9f') 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: Wed, 08 Aug 2012 01:24:56 GMT
Authorization: SharedKeyLite <foo>
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Content-Type: application/atom+xml
If-Match: *
Host: foo.table.core.windows.net
Content-Length: 1047

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title />
  <author>
    <name />
  </author>
  <updated>2012-08-08T01:24:56.9434703Z</updated>
  <id>https://foo.table.core.windows.net/foo('87a23657-9206-4450-a7ca-09d599b41b9f')</id>
  <content type="application/xml">
    <m:properties>
      <d:EmailAddress>foo</d:EmailAddress>
      <d:Enabled m:type="Edm.Boolean">false</d:Enabled>
      <d:Id>87a23657-9206-4450-a7ca-09d599b41b9f</d:Id>
      <d:LastSignIn m:null="true" />
      <d:Name>new</d:Name>
      <d:PIN>0000</d:PIN>
      <d:PartitionKey>sandbox</d:PartitionKey>
      <d:RowKey>87a23657-9206-4450-a7ca-09d599b41b9f</d:RowKey>
      <d:SignupDate m:null="true" />
      <d:Timestamp m:type="Edm.DateTime">0001-01-01T00:00:00</d:Timestamp>
    </m:properties>
  </content>
</entry>

UpdateObject() の呼び出しは次のとおりです。

Public Sub Update(existingItem As UserDataModel)
    _ServiceContext.AttachTo(UserDataServiceContext.UserTableName, existingItem, "*")
    _ServiceContext.UpdateObject(existingItem)
    _ServiceContext.SaveChanges()
End Sub

サービス コンテキストを初期化するコードは次のとおりです。

Public Sub New()
    Try
        Dim storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString")
        _ServiceContext = New UserDataServiceContext(storageAccount.TableEndpoint.ToString(), storageAccount.Credentials)
        _ServiceContext.IgnoreResourceNotFoundException = True
        ' Create the tables
        ' In this case, just a single table.  
        storageAccount.CreateCloudTableClient().CreateTableIfNotExist(UserDataServiceContext.UserTableName)
    Catch ex As Exception
        Debug.WriteLine("Problem with New() UserDataSource. Error: " & ex.Message)
    End Try
End Sub

他に提供できるものがあれば教えてください...

乾杯、

トーマス

編集 1: Fiddler で挿入が成功すると、次のようになります。

POST https://foo.table.core.windows.net/<tablename> 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: Wed, 08 Aug 2012 15:41:36 GMT
Authorization: SharedKeyLite <key>
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Content-Type: application/atom+xml
Host: <tablename>.table.core.windows.net
Content-Length: 990

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title />
  <author>
    <name />
  </author>
  <updated>2012-08-08T15:41:36.3923506Z</updated>
  <id />
  <content type="application/xml">
    <m:properties>
      <d:EmailAddress>foo@gmail.com</d:EmailAddress>
      <d:Enabled m:type="Edm.Boolean">false</d:Enabled>
      <d:Id>74cdf74d-4eea-40b8-93c4-a7f8bc01c387</d:Id>
      <d:LastSignIn>634800372963013454</d:LastSignIn>
      <d:Name>(test)</d:Name>
      <d:PIN>0000</d:PIN>
      <d:PartitionKey>sandbox</d:PartitionKey>
      <d:RowKey>74cdf74d-4eea-40b8-93c4-a7f8bc01c387</d:RowKey>
      <d:SignupDate>634800372963013454</d:SignupDate>
      <d:Timestamp m:type="Edm.DateTime">0001-01-01T00:00:00</d:Timestamp>
    </m:properties>
  </content>
</entry>
4

1 に答える 1