这是一个非常具体的问题,但我的想法已经用完了。我正在使用Silverlight 4.0和WCF数据服务。错误'网络响应包含意外的部分。当我在Silverlight客户端中调用Context上的SaveChanges时,ID = 16'正在发生。有趣的是,相同的调用/代码适用于更简单的保存,但不是更复杂(图中的更多对象),我很确定它一次可以工作。数据也会进入数据库,因此必须在服务器上成功。
我已经用Fiddler捕获了不同$批量请求的数据包,我唯一的区别就是那个失败的实体中有更多的实体。
在此代码中,客户端抛出DataServiceRequestException:
this.Context.BeginSaveChanges(SaveChangesOptions.Batch, new AsyncCallback((iar) =>
{
ServiceOperationStatus status = ServiceOperationStatus.Success;
try
{
// Callback method for the async request, retrieves the status of the requested action
DataServiceResponse response = this.Context.EndSaveChanges(iar);
...
我找到的唯一网页是: http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/c81cb454-01f5-4413-a99b-4ad059c5901f http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/3bb4cef6-7f1e-4875-a140-271fe8ebb3cb/〜提到Azure中的线程,但我很确定我没有这个问题。我正在通过按钮单击命令调用save方法。
我很感激任何想法。我将开始查看我的数据库,以确保我没想到的事情没有改变。我会在发现它时添加更多信息。
编辑:从Fiddler添加了擦除捕获的$ batch(我更改了一些名称并删除了属性以删除域特定信息)
--batchresponse_b7b32f26-5246-4d02-9a6e-24ab6156d798
Content-Type: multipart/mixed; boundary=changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 249
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/DT(314)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/DT(314)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="DTemplate" href="DT(314)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ZFields" type="application/atom+xml;type=feed" title="ZFields" href="DT(314)/ZFields" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/DSize" type="application/atom+xml;type=entry" title="Size" href="DT(314)/DSize" />
<category term="DataModels.DTemplate" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 250
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/ZFields(351)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/ZFields(351)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="ZField" href="ZFields(351)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/DT" type="application/atom+xml;type=feed" title="DT" href="ZFields(351)/DT" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Media" type="application/atom+xml;type=feed" title="Media" href="ZFields(351)/Media" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Playlists" type="application/atom+xml;type=feed" title="Playlists" href="ZFields(351)/Playlists" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Layout" type="application/atom+xml;type=entry" title="Layout" href="ZFields(351)/Layout" />
<category term="DataModels.ZField" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 251
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/Layouts(412)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/Layouts(412)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Layout" href="Layouts(412)" />
<category term="DataModels.Layout" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 252
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 253
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 254
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/Playlists(13410)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/Playlists(13410)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Playlist" href="Playlists(13410)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PlaylistItems" type="application/atom+xml;type=feed" title="PlaylistItems" href="Playlists(13410)/PlaylistItems" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SEntities" type="application/atom+xml;type=feed" title="SEntities" href="Playlists(13410)/SEntities" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SConstraint" type="application/atom+xml;type=entry" title="SConstraint" href="Playlists(13410)/SConstraint" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PlaylistMode" type="application/atom+xml;type=entry" title="PlaylistMode" href="Playlists(13410)/PlaylistMode" />
<category term="DataModels.Playlist" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 255
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/SConstraints(18677)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/SConstraints(18677)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="SConstraint" href="SConstraints(18677)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/TimeRanges" type="application/atom+xml;type=feed" title="TimeRanges" href="SConstraints(18677)/TimeRanges" />
<category term="DataModels.SConstraint" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 256
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 257
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/TimeRanges(16222)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/TimeRanges(16222)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="TimeRange" href="TimeRanges(16222)" />
<category term="DataModels.TimeRange" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 258
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 259
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 260
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/PlaylistItems(1555717)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/PlaylistItems(1555717)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="PlaylistItem" href="PlaylistItems(1555717)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Playlist" type="application/atom+xml;type=entry" title="Playlist" href="PlaylistItems(1555717)/Playlist" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SConstraint" type="application/atom+xml;type=entry" title="SConstraint" href="PlaylistItems(1555717)/SConstraint" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PExclusion" type="application/atom+xml;type=feed" title="PExclusion" href="PlaylistItems(1555717)/PExclusion" />
<category term="DataModels.PlaylistItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 261
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 262
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/SConstraints(18676)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/SConstraints(18676)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="SConstraint" href="SConstraints(18676)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/TimeRanges" type="application/atom+xml;type=feed" title="TimeRanges" href="SConstraints(18676)/TimeRanges" />
<category term="DataModels.SConstraint" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 263
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Content-ID: 264
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/atom+xml;charset=utf-8
Location: http://localhost/Services/EDMDataService.svc/TimeRanges(16221)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://localhost/Services/EDMDataService.svc/" 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">
<id>http://localhost/Services/EDMDataService.svc/TimeRanges(16221)</id>
<title type="text"></title>
<updated>2011-11-15T21:16:31Z</updated>
<author>
<name />
</author>
<link rel="edit" title="TimeRange" href="TimeRanges(16221)" />
<category term="DataModels.TimeRange" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 265
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_d4c80211-1c69-4d36-98fd-df47e2383914--
--batchresponse_b7b32f26-5246-4d02-9a6e-24ab6156d798--