如何调试本地存储的问题? “处理此请求时发生错误”的问题 在 HandleBatchResponse 中

发布于 2024-07-30 11:06:25 字数 2614 浏览 4 评论 0原文

交叉发布于 MSDN< /a>.

我有一个实体对象列表,我试图插入到本地存储服务的表中。 使用从 SampleClient TableStorageDataContext 类派生的数据上下文类,我创建了一个新的上下文对象并毫无问题地添加了实体。 当我调用 context.SaveChanges() 时,最终会抛出一个异常,但细节很少。 我在 SQL Server Express 上运行了探查器跟踪,以查看错误是否源自那里,但没有找到任何有用的信息,这让我相信本地存储服务存在一些问题,但我不知道如何调试。

这是客户端代码 (F#):

let cxt0 = new WebRole.Models.TableDataContext()
entityList |> Seq.iter (fun n -> cxt0.AddObject("NutritionData", n))
let results = cxt0.SaveChanges()

我可以在上述行的最后一行设置断点并停止执行,并查看 cxt0 对象包含要添加的所有实体 (> 500K)。 然后继续执行,抛出如下异常:

System.Data.Services.Client.DataServiceRequestException: “处理时发生错误 这个请求。”

在 System.Data.Services.Client.DataServiceContext.SaveAsyncResult.HandleBatchResponse() 在 System.Data.Services.Client.DataServiceContext.SaveAsyncResult.EndRequest() 在 System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions 选项)在 System.Data.Services.Client.DataServiceContext.SaveChanges() 在 WorkerRole.SrDataProcessor.importSrData(FastFunc`2 pf, 字符串 blobName) 中 C:\Users\Ben\Development\Projects\CloudProject\WorkerRole\SrDataProcessor.fs:line 76

InnerException(请原谅括号,因为我避免使用 html 标签清理器):

System.Data.Services.Client.DataServiceClientException: “ [?xml版本=“1.0”编码=“utf-8” 独立=“是”?] [错误 xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"] [代码][/代码] [留言 xml:lang="en-US"]发生错误 在处理这个的时候 请求。[/消息] [/错误]“

在 System.Data.Services.Client.DataServiceContext.SaveAsyncResult.d__1d.MoveNext()

在 HandleBatchResponse 方法中,似乎在枚举响应时可能会报告此错误。 有什么想法可以称之为什么吗? 我想检查但没有检查的唯一一件事是确保我的实体都不具有超过 1000 个字符的字符串属性。

更新:现在我有了,但看起来没有。 以下代码片段生成了一个空序列:

let longEntities = 
    nutData |> Seq.choose (fun nd -> if HasLongStringProperties(nd)
                                     then Some(nd) else None)

另外,更一般地说,如何调试这样的问题? 有什么方法可以对本地存储服务进行一些反思吗?

更新2:我发现“起源异常”实际上是一个报告“内部服务器错误(500)”的System.WebException,但没有进一步的细节。 我已尽我所能来确保我尝试插入的数据与支持表服务的 SQL Server Express 数据库中的表中的架构和数据类型兼容,但我仍然不知道是什么问题是。 TableDataService 只是不会接受我插入的对象。 有关更多详细信息,请参阅 MSDN 线程。 我还打开了连接错误

Cross-posted at MSDN.

I have a list of entity objects I'm trying to insert into a table in the local storage service. Using a data context class derived from the SampleClient TableStorageDataContext class, I create a new context object and add the entities with no issues. When I call context.SaveChanges(), an exception is ultimately thrown, but with sparingly little detail. I've run a profiler trace on SQL Server Express to see if the error originated there, and didn't find anything useful, which leads me to believe there's some issue in the local storage service, which I have no idea how to debug.

Here's the client code (F#):

let cxt0 = new WebRole.Models.TableDataContext()
entityList |> Seq.iter (fun n -> cxt0.AddObject("NutritionData", n))
let results = cxt0.SaveChanges()

I can set a breakpoint on the last of the above lines and stop execution and see that the cxt0 object contains all the entities to be added (>500K). After then continuing execution, the following exception is thrown:

System.Data.Services.Client.DataServiceRequestException:
"An error occurred while processing
this request."

at
System.Data.Services.Client.DataServiceContext.SaveAsyncResult.HandleBatchResponse()
at
System.Data.Services.Client.DataServiceContext.SaveAsyncResult.EndRequest()
at
System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions
options) at
System.Data.Services.Client.DataServiceContext.SaveChanges()
at
WorkerRole.SrDataProcessor.importSrData(FastFunc`2
pf, String blobName) in
C:\Users\Ben\Development\Projects\CloudProject\WorkerRole\SrDataProcessor.fs:line
76

The InnerException (pardon the brackets as I avoid the html tag scrubber):

System.Data.Services.Client.DataServiceClientException:
" [?xml version="1.0" encoding="utf-8"
standalone="yes"?] [error
xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"]
[code][/code] [message
xml:lang="en-US"]An error occurred
while processing this
request.[/message] [/error] "

at
System.Data.Services.Client.DataServiceContext.SaveAsyncResult.d__1d.MoveNext()

In the HandleBatchResponse method, it appears that this error may be reported as it enumerates through the responses. Any ideas what might be calling this? The only thing left I've thought to check but haven't is to ensure that none of my entities have string properties that go past 1000 characters.

Update: Now I have, and it doesn't look like there are any. The following snippet produced an empty sequence:

let longEntities = 
    nutData |> Seq.choose (fun nd -> if HasLongStringProperties(nd)
                                     then Some(nd) else None)

Also, more generally, how does one debug issues like this? Is there any way to get some introspection into the local storage service?

Update 2: I've since discovered that the "exception of origin", so to speak, is actually a System.WebException reporting an "Internal Server Error (500)", with no further detail. I've done everything I know to do to ensure that the data I'm trying to insert is compatible with the schema and data types in the tables in the SQL Server Express database backing the table service, and still I don't know what the issue is. The TableDataService just won't accept the object I'm inserting. See the MSDN thread for more details. I've also opened a bug on connect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吖咩 2024-08-06 11:06:25

我试图做一个非常简单的演示,我遇到了同样的问题,但我终于弄清楚了。 通过在打开日志记录的情况下针对开发存储运行:
看:
http://blogs.msdn。 com/b/partlycloudy/archive/2009/12/16/development-storage-logging.aspx

启动 DevelopmentStorage 后,运行我的应用程序,然后停止开发存储并查看日志文件夹,我看到:

9 /17/2010 1:30:47 PM [错误] 在执行表操作期间捕获异常并重新抛出: System.Exception: c:\Users\Scott\AppData\Local\Temp\jvcl5gjz.0.cs(14,23) : 的封闭类型相同

错误 CS0542:“Number”:成员名称不能与其位于 x:\rd\rd_store_stable\services 中 Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableManager.EndPerformOperation(IAsyncResult ar) \xstore\XFE\table\service\Protocols\REST\src\TableManager.cs:第 184 行
在 x:\rd\rd_store_stable\services\xstore\XFE\table\service\Protocols\REST\src\TableProtocolHead 中的 Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableProtocolHead.d__3e.MoveNext() 处。 cs:line 732

事实证明我的演示太简单了,因为我创建了一个名为 Number 的表,其中只有一个名为 Number 的列...

I was trying to do an extremely simple demo and I had the same problem but I was finally able to figure it out. By running against the development storage with logging turned on:
See:
http://blogs.msdn.com/b/partlycloudy/archive/2009/12/16/development-storage-logging.aspx

After starting the DevelopmentStorage, running my app, and then stopping the development storage and looking in the log folder I see:

9/17/2010 1:30:47 PM [Error] Caught exception during performing table operation and rethrow: System.Exception: c:\Users\Scott\AppData\Local\Temp\jvcl5gjz.0.cs(14,23) : error CS0542: 'Number': member names cannot be the same as their enclosing type

at Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableManager.EndPerformOperation(IAsyncResult ar) in x:\rd\rd_store_stable\services\xstore\XFE\table\service\Protocols\REST\src\TableManager.cs:line 184
at Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableProtocolHead.d__3e.MoveNext() in x:\rd\rd_store_stable\services\xstore\XFE\table\service\Protocols\REST\src\TableProtocolHead.cs:line 732

It turns out that my demo was too simple, because I had created a table called Number with a single column called Number...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文