我想制作一个将 blob 上传到 azure 存储的示例应用程序。我已关注this和 this ,两种方式都会引发 MobileServiceInvalidOperationException
500 - 内部服务器错误。请尽快给我解决方案。谢谢。
这是错误日志
Error inserting: { AlbumId: 22,
Name: 'ff',
Description: 'ff', ThumbnailUrl: null,
ThumbnailFileName: '73a594b1-1abb-476d-a1ce-73a12d6ee278_thumbnail.png', ImageUrl: null, FileName: '73a594b1-1abb-476d-a1ce-73a12d6ee278.png', imageurl: 'https://xxxxxxx.blob.core.windows.net/mypictures-undefined/undefined?se=2013-02-07T10%3A44%3A57Z&sr=b&sp=w&sig=qDBnnVOyo8XCNSUNJcn49IMcN4laDIgjZ8oM9TdiHBI%3D', thumbnailurl: 'https://xxxxxxx.blob.core.windows.net/mypictures-undefined/undefined?se=2013-02-07T10%3A44%3A57Z&sr=b&sp=w&sig=qDBnnVOyo8XCNSUNJcn49IMcN4laDIgjZ8oM9TdiHBI%3D' }
{
[Error: [Microsoft][SQL Server Native Client 10.0][SQL Server]The column name 'ImageUrl' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.] sqlstate: '42000', code: 264
}
最佳答案
同一个 (JavaScript) 对象上有两个大小写不同的属性,但其背后的 Windows Azure SQL 数据库实例在涉及列名称时不区分大小写。
您的 C# 类似乎包含一个名为 ImageUrl
的属性(注意大小写),然后在表的插入脚本中(根据 the reference you quoted ),您正在执行 item.imageurl
全部小写。
您可以添加 DataMember属性到你的 C# 属性,我怀疑你会没事的。
[DataMember(Name = "imageurl")]
public String ImageUrl { get; set; }
与ThumbnailUrl
相同
关于c# - MobileServiceInvalidOperationException 500 - 插入表时出现内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14748805/