日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
WCF字符串過(guò)長(zhǎng)問(wèn)題解決方法指南

WCF框架是一個(gè)比較常用的開(kāi)發(fā)框架,可以幫助開(kāi)發(fā)人員實(shí)現(xiàn)許多功能,提供了相當(dāng)大的幫助。編寫(xiě)基于WCF服務(wù)的程序時(shí),向WCF服務(wù)端發(fā)送一長(zhǎng)串的HTML源碼,結(jié)果客戶端收到提示如下:#t#

格式化程序嘗試對(duì)消息反序列化時(shí)引發(fā)異常: 對(duì)操作“AddArticle”的請(qǐng)求消息正文進(jìn)行反序列化時(shí)出現(xiàn)錯(cuò)誤。讀取 XML 數(shù)據(jù)時(shí),超出***字符串內(nèi)容長(zhǎng)度配額 (8192)。通過(guò)更改在創(chuàng)建 XML 讀取器時(shí)所使用的 XmlDictionaryReaderQuotas 對(duì)象的 MaxStringContentLength 屬性,可增加此配額。 第 64 行,位置為 79。

WCF字符串過(guò)長(zhǎng)問(wèn)題主要是maxStringContentLength和maxReceivedMessageSize的設(shè)置會(huì)影響到消息的發(fā)送和接收,于是全部改為2MB大小,即2097152。

客戶端app.config修改以解決WCF字符串過(guò)長(zhǎng)問(wèn)題:

  1. < bindings> 
  2. < basicHttpBinding> 
  3. < binding name="BasicHttpBinding_ShareService" 
    closeTimeout="00:01:00" 
  4. openTimeout="00:01:00" receiveTimeout="
    00:10:00" sendTimeout="00:01:00" 
  5. allowCookies="false" bypassProxyOnLocal=
    "false" hostNameComparisonMode="StrongWildcard" 
  6. maxBufferSize="65536" maxBufferPoolSize=
    "524288" maxReceivedMessageSize="2097152" 
  7. messageEncoding="Text" textEncoding=
    "utf-8" transferMode="Buffered" 
  8. useDefaultWebProxy="true"> 
  9. < !-- Reset maxStringContentLength 
    for deserialize --> 
  10. < readerQuotas maxDepth="32" 
    maxStringContentLength="2097152"
     maxArrayLength="16384" 
  11. maxBytesPerRead="4096" maxName
    TableCharCount="16384" /> 
  12. < security mode="None"> 
  13. < transport clientCredentialType="None" 
    proxyCredentialType="None" 
  14. realm="" /> 
  15. < message clientCredentialType="UserName" 
    algorithmSuite="Default" /> 
  16. < /security> 
  17. < /binding> 
  18. < /basicHttpBinding> 
  19. < /bindings> 

服務(wù)端web.config修改解決WCF字符串過(guò)長(zhǎng)問(wèn)題:

 
 
 
  1. < system.serviceModel> 
  2. < !-- add for the message size --> 
  3. < bindings> 
  4. < basicHttpBinding> 
  5. < binding name="NewBinding2MB" 
    maxReceivedMessageSize="2097152"> 
  6. < readerQuotas maxString
    ContentLength="2097152" /> 
  7. < /binding> 
  8. < /basicHttpBinding> 
  9. < /bindings> 
  10. < !-- add for the message size --> 
  11. < behaviors> 
  12. < serviceBehaviors> 
  13. < behavior name="Web.WCF.
    ShareServiceBehavior"> 
  14. < serviceMetadata httpGetEnabled="true"/> 
  15. < serviceDebug includeException
    DetailInFaults="false"/> 
  16. < /behavior> 
  17. < /serviceBehaviors> 
  18. < /behaviors> 
  19. < serviceHostingEnvironment aspNet
    CompatibilityEnabled="true"/> 
  20. < services> 
  21. < service behaviorConfiguration=
    "Web.WCF.ShareServiceBehavior" 
    name="Web.WCF.ShareService"> 
  22. < endpoint address="" binding=
    "basicHttpBinding" bindingConfiguration=
    "NewBinding2MB" contract="Web.WCF.ShareService"/> 
  23. < endpoint address="mex" binding=
    "mexHttpBinding" contract="IMetadataExchange"/> 
  24. < /service> 
  25. < /services> 
  26. < /system.serviceModel> 

網(wǎng)頁(yè)題目:WCF字符串過(guò)長(zhǎng)問(wèn)題解決方法指南
分享網(wǎng)址:http://www.5511xx.com/article/cdhdges.html