Table storage (emulator) insert fails with “One of the request inputs is not valid.”

旧时模样 提交于 2019-12-10 17:48:51

问题


I have an import process that takes data from an old source and puts it into table storage, which allows me to re-init table storage and start over as needed. It was working prior to updating to the October Azure SDK for .NET (VS2012). Now, it fails after inserting a few entities (it seems to vary, the imported data is not static in nature). The first entity, of the same type, always inserts successfully. The partition keys are unique, and the RowKey for each is an empty string (not null). It is failing specifically on SaveChangesWithRetries(). Are there any changes in the new SDK that would be incompatible with what I was doing before?

Update

I've been inspecting the actual XML of successfully inserted rows by querying the table storage database. One thing I noticed is that a nullable int column on the entity has SqlType nvarchar(max) when it's null, and int when it's not null. Is this intended?


回答1:


So, I've been able to successfully reproduce the error on a consistent basis, and it turns out that it's a pretty nasty bug introduced in the October 2012 SDK.

Any string ending with a space will cause the exception to be thrown. Calling Trim() on all string inputs has solved this issue.




回答2:


This is clearly one of the issues with the emulator. As you might know, it simulates Table Storage in SQL Server. This works in most cases, but when you try to do something special like adding extra properties or in your case simply mix nullable and not nullable values in a property things tend to go bad.

This page explains the differences between the actual Table Storage service and the implementation in the emulator. But your issue doesn't seem to be documented just yet. You'll find many reports of issues with the Table Storage emulator (also here on StackOverflow).

The only solution for you is to develop with a real storage account instead of using the emulator.




回答3:


This issue has been fixed in later versions of the Windows Azure SDK. Install the latest version to fix the problem. http://www.windowsazure.com/en-us/downloads/



来源:https://stackoverflow.com/questions/13104874/table-storage-emulator-insert-fails-with-one-of-the-request-inputs-is-not-val

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!