当数据库结果非常好时,我该如何处理WCF服务?
问题描述:
我使用以下代码:当数据库结果非常好时,我该如何处理WCF服务?
private class WcfProxy<TService> :
ClientBase<TService> where TService : class, IContract
{
public TService WcfChannel
{
get
{
return Channel;
}
}
}
protected TResult ExecuteCommand<TResult>(Func<TContract, TResult> command)
where TResult : IDtoResponseEnvelop
{
var proxy = new WcfProxy<TContract>();
try
{
var result = command.Invoke(proxy.WcfChannel);
proxy.Close();
return result;
}
catch (CommunicationException ex)
{
proxy.Abort();
throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_CommunicationException_TransportInEnamDataIsInvalid, ex);
}
catch (TimeoutException ex)
{
proxy.Abort();
throw new BusinessException(BusinessExceptionEnum.Operational, Properties.Resources.Exception.WcfAdapterBase_TimeoutException, ex);
}
catch (Exception)
{
proxy.Abort();
throw;
}
}
当查询返回结果 的高电流量i与此消息会遇到:
通信对象不能用于通信,因为它是处于故障状态
确实存在一种方式或伎俩,我观察数据库查询成功的结果 或我分开结果或获得部分结果的方式?因为你抛出一个错误
The communication object cannot be used for communication because it is in the Faulted state.
,它不被处理,并得到投掷在的iis池:
答
可能因此大受到enlatge maxReceivedMessageSize,或结合其它参数之一。
您还可以启用WCF跟踪,并与svcTraceViewer.exe
审查
我设置maxReceivedMessageSize到2147483647,因为如果设置比我有错误 – 2013-04-22 07:03:59
其权利的确定遇到,因为这个数字是最大的整数较大。想你是否真的需要它如此之大:) – evgenyl 2013-04-22 07:08:22