c# - MobileServiceInvalidOperationException 500 - 插入表时出现内部服务器错误

标签 c# azure windows-8 microsoft-metro azure-mobile-services

我想制作一个将 blob 上传到 azure 存储的示例应用程序。我已关注thisthis ,两种方式都会引发 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/

相关文章:

c# - 使用 `in` 运算符从 id 列表中查找所有 MongoDB 文档

c# - 使用 json.net 在序列化期间合并两个对象?

c# - 文件助手源代码

c# string to float 转换不正确

azure - 如何将遥测数据输入到 Windows 10 UWP 应用程序中?

visual-studio-2012 - Visual Studio 2012 探查器不会产生任何输出 (Windows 8)

xaml - 在 XAML GridView (Win8/Metro) 中水平订购项目

azure - 有两个azure应用程序服务具有相同的IP正常吗?

node.js - Azure Web App Bot - OAuth 完成后触发事件

c# - 是否可以在 C# 中编写将在 Windows 8 Metro 环境中运行的 Ping 类?