WCF数据-查询大数据异常:DataServiceTransportException [英] WCF Data - Querying big data exception: DataServiceTransportException

查看:57
本文介绍了WCF数据-查询大数据异常:DataServiceTransportException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在查询数据时遇到问题.包含大约5万行的表格.当我查询前100行时,没有问题.但是,如果我全选,则会出现异常.有没有办法让我增加 超时长度或我可以查询的数据大小?下面是两个源代码,一个来自WebApplication(MWTService.svc.cs),另一个是执行查询的客户端应用程序(Program.cs).

I'm experiencing some issue with querying data.  A table which contains roughly more than 50k rows.  When I query the first 100 rows, there is no issue.  But if I select all, I get an exception.  Is there a way for me to increase the timeout length or the amount of data size that I can query?  Below are two source code, 1 is from the WebApplication(MWTService.svc.cs) and the other is the Client application(Program.cs) which executes the query.

///WebService应用程序

/// WebService Application

MWTService.svc.cs

MWTService.svc.cs

使用系统;
使用System.Collections.Generic;
使用System.Data.Services;
使用System.Data.Services.Common;
使用System.Linq;
使用System.ServiceModel.Web;
使用System.Web;
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;

推荐答案

您能与我们分享DataServiceTransportException的内部异常吗?

Could you share us the inner exception of DataServiceTransportException?

您是在IIS中托管服务还是自行托管?我建议您点击下面的链接来修改服务配置.

Did you host your service in IIS or self-host? I suggest you follow below link to modify your service configuration.

1)      Visual Studio的webdev服务器(Cassini)无法处理HTTP上的流.为了测试,您 需要在控制台应用程序中托管或通过WCF主机实用程序托管. (就像我在示例中所做的一样.)

2) ; IIS使用ASP.NET
maxRequestLength &setting 对于最大长度,而不是设置中定义的WCF设置.您需要将其添加到web.config中,以确保IIS能够返回请求的数据. 
3) IIS不能传输超过2GB的数据.如果您需要发送更多数据,则需要自行托管才能解决此问题
4)为避免超时,您将需要增加客户端的接收超时(就像我在FormsClient的 如下所示的配置.除了增加的maxBuffersize和maxRecievedMessageSize之外,还请注意扩展的receveTimeouts.

1)     Visual Studio’s  webdev server (Cassini) cannot handle streaming over HTTP.   For testing, you need to host in a console application or through the WCF host utility.  (As I have done in the sample). 
2)     IIS uses the ASP.NET maxRequestLength setting for the max length not the setting defined WCF setting.   You will need to add this to your web.config to ensure IIS is able to return the data requested. 
3)    IIS cannot transfer more than 2GB of data. You’ll need to self host to get around this if you need to send more data than that. 
4)    To avoid timeouts, you will need to increase the receive timeouts on the client (as I have done in the FormsClient’s configuration shown below.  Note the extended recieveTimeouts in addition to both the increased maxBuffersize and maxRecievedMessageSize).

#使用WCF传输大块数据

#Transferring large blobs of data with WCF

https://博客. msdn.microsoft.com/ryberry/2010/04/20/transferring-large-blobs-of-data-with-wcf/


这篇关于WCF数据-查询大数据异常:DataServiceTransportException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆