如何设置MaxReceivedMessageSize磁盘配额怎么设置

君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
如何解决已超过传入消息(65536)的最大消息大小配额这个有关问题
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口您的位置: >>
今天看了一些官方的资料和配置,简单写了一个WCF服务来传递一个文件,借此看看WCF传输大文件的能力,这里采用的是NetTcp绑定,之所以没有采用 basicHttpBinding是因为考虑这种方式和WebService相近,大家都写的比较多了。
  服务实现
  服务中有一个上传二进制流的方法UpLoad:
[ServiceContract]public interface IAddService{  [OperationContract]  void UpLoad(byte[] file);}
  (为了减少时间,采用了一点硬编码)
public class AddService:IAddService{  public void UpLoad(byte[] file)  {    System.IO.File.WriteAllBytes("d:/8.rmvb", file);//将上传的文件放到D盘下并命名  }}
  服务的配置
  App.config是WCF的重头戏,这里的配置直接影响到服务的成败和性能。先定义一个netTcpBinding供服务使用:
&bindings&&netTcpBinding&&binding name="netTcpBindConfig"closeTimeout="00:01:00"openTimeout="00:01:00"receiveTimeout="00:10:00"sendTimeout="00:01:00"transactionFlow="false"transferMode="Buffered"transactionProtocol="OleTransactions"hostNameComparisonMode="StrongWildcard"listenBacklog="10"maxBufferPoolSize=" "maxBufferSize=" "maxConnections="10"maxReceivedMessageSize=" "&&readerQuotas maxDepth="32"maxStringContentLength=" "maxArrayLength=" "maxBytesPerRead="4096"maxNameTableCharCount="16384" /&&reliableSession ordered="true"inactivityTimeout="00:10:00"enabled="false" /&&security mode="Transport"&&transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /&&/security&&/binding&&/netTcpBinding&&/bindings&
  这个配置需要注意maxConnections="10" 这个选项,如果你想改成最大连接为100就会在运行时报下面的错误。查了一下MSDN,原来如果是windows7,xp,2000,vista在TCP的同时在线数量是有限制的,超出10就会报错。而如果想要更大的连接数,需要部署到windows server上。
  如果想传输大文件,下面几个配置也是必不可少的:
  maxBufferPoolSize=" "
  maxBufferSize=" " &
&  maxReceivedMessageSize=" "
  当然,还有配额的大小:
&readerQuotas maxDepth="32" maxStringContentLength=" " maxArrayLength=" " maxBytesPerRead="4096" maxNameTableCharCount="16384" /&
  配置Behavior:
&behaviors&&serviceBehaviors&&behavior name="WCFLibrary.UpdateUserBehavior"&&serviceMetadata/&&serviceDebug includeExceptionDetailInFaults="false"/&&/behavior&&/serviceBehaviors&&/behaviors&
  最后是服务:
&service behaviorConfiguration="WCFLibrary.UpdateUserBehavior" name="WCFLibrary.AddService"&&host&&baseAddresses&&add baseAddress="net.tcp://localhost:4506/AddService"/&&/baseAddresses&&/host&&endpoint address="" binding="netTcpBinding" contract="WCFLibrary.IAddService" bindingConfiguration="netTcpBindConfig"&&/endpoint&&endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" &&/endpoint&&/service&
  关于服务的配置详情,请看之前写的几篇文章。
  客户端调用
  服务配置好后,启动,客户端使用net.tcp://localhost:4506/AddService/mex引用这个服务以便生成本地代理
  代码都是很简单的了:
protected void Page_Load(object sender, EventArgs e){  DateTime start = DateTime.N  AddService.AddServiceClient proxy = new AddService.AddServiceClient();  proxy.UpLoad(System.IO.File.ReadAllBytes("f:/8.rmvb"));  Response.Write(start+" 开 始---"+DateTime.Now+" 结 束");}
  测试结果
  用时8秒种:
  文件信息:
  文件按照151M,传输时间是8秒来计算,大概用时为:151(M)/8(S)=18.875M/S.很不错的速度,不是吗?
.NET技术热门文章
.NET技术最新文章所有回答(2)
你解决了没有,我现在有相同问题!
配置wcf配置文件:
&binding name="BasicHttpBinding_IPaiPaiService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="" maxBufferPoolSize="" maxReceivedMessageSize="" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"& &readerQuotas maxDepth="64" maxStringContentLength="" maxArrayLength="" maxBytesPerRead="" maxNameTableCharCount="" /& &security mode="None"& &transport clientCredentialType="None" proxyCredentialType="None" realm="" /& &message clientCredentialType="UserName" algorithmSuite="Default" /& &/security& &/binding&
1.重新生成项目,未解决 参考步骤22.重新添加服务引用,在配置,重新生成
&&&您需要以后才能回答,未注册用户请先。3981人阅读
技术_.NET(38)
做的windows应用程序(后台调用webservice),数据量大的时候,报错如下:
municationException: 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。 ---& System.ServiceModel.QuotaExceededException: 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。&&
解决办法:在配置文件中(app.config)设置如下代码(配置MaxReceivedMessageSize):
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:79845次
积分:1468
积分:1468
排名:第18417名
原创:70篇
(1)(1)(2)(2)(1)(1)(2)(2)(3)(1)(1)(3)(1)(4)(4)(4)(7)(4)(6)(4)(4)(4)(5)(5)}

我要回帖

更多关于 win10磁盘配额设置 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信