关于WCF的业务对象的最大限制 [英] Maximum limit of business object with respect to WCF

查看:75
本文介绍了关于WCF的业务对象的最大限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Business对象,其中包含约40-45个属性.我有一个问题,关于WCF,业务对象的限制是多少?由于将通过WCF调用我的BO,因此将支持多少数据.由于通过WCF调用时,所有属性都可能具有价值.<解决方案

通常,服务和客户端之间以XML形式进行通信,因此数据大小是最主要的. >
在WCF中,我们可以配置要从服务器到客户端传输的大小数据.
使用Binding元素,您可以设置.使用maxReceivedMessageSize或使用readerQuotas.请参考microsft网站以获取详细信息
http://msdn.microsoft.com/en-us/library/ms731361.aspx

示例:

< wshttpbinding>
 < binding name = "  closetimeout = "  10:15:00" "  receiveTimeout = "  10:15:00" sendTimeout =   10:15:00" passbyProxyOnLocal =   false" transactionFlow = "  hostNameComparisonMode = " 
     maxBufferPoolSize = "  maxReceivedMessageSize = "  2147483647" messageEncoding =  文本" 
     textEncoding = "  useDefaultWebProxy = " span>  true" allowCookies =   false" > 
     < readerquotas maxdepth = "  maxstringcontentlength = "  2147483647" maxarraylength =   2147483647" > 
      maxBytesPerRead = "  maxNameTableCharCount = "  16384"/>
     < reliablesessionordered = "  inactivitytimeout = "  10:15:00" " />
</ 可靠的会话 >  </ 阅读器报价 >  </ 绑定 > 
</  wshttpbinding  >  


很简单,就是在运行时计算业务对象的大小

BinaryFormatter bf =新的BinaryFormatter();
MemoryStream ms =新的MemoryStream();
bf.Serialize(ms,YourBusinessObject);
返回ms.ToArray();

此数组返回的大小将是您的业务对象的大小.


I have created a Business object which contains around 40-45 properties. I have a question that what is the limit of business object with respect to WCF. As my BO will be called through WCF, so how much data will that support. As all properties may have value when called through WCF

解决方案

Normally communcation between you service and client in the form of XML, so data size is main thing.

In WCF we can configure how much the size data to trnasfer from server to client.
using Binding element you can set.using maxReceivedMessageSize or using readerQuotas. Please refer microsft site for details
http://msdn.microsoft.com/en-us/library/ms731361.aspx

Example:

<wshttpbinding>
 <binding name="WSHttpBinding_Service" closetimeout="10:15:00">
     openTimeout="00:30:00" receiveTimeout="10:15:00" sendTimeout="10:15:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"
     textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     <readerquotas maxdepth="32" maxstringcontentlength="2147483647" maxarraylength="2147483647">
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <reliablesession ordered="true" inactivitytimeout="10:15:00">
      enabled="false" />
</reliablesession></readerquotas></binding>
</wshttpbinding>


Got a very easy was to calculate the size of business object at run time

BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, YourBusinessObject);
return ms.ToArray();

What ever size this array will return, that will be the size of your business object.


这篇关于关于WCF的业务对象的最大限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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