自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

WCF配置文件相關(guān)操作技巧解析

開發(fā) 開發(fā)工具
WCF配置文件只要做一下簡(jiǎn)單的修改操作,就可以幫助我們實(shí)現(xiàn)上傳數(shù)據(jù)大小的限制。希望大家通過(guò)本文介紹的內(nèi)容就可以掌握這一技巧應(yīng)用。

如何運(yùn)用WCF實(shí)現(xiàn)上傳數(shù)據(jù)大小的控制,取決于我們對(duì)WCF配置文件的修改方法。在這里就為大家詳細(xì)介紹一下WCF配置文件的一些修改技巧,以達(dá)到文件大小控制的目的。#t#

默認(rèn)情況下,wcf的服務(wù)端如果發(fā)生異常是不會(huì)將詳細(xì)異常發(fā)送給客戶端的,客戶端只能提到以下籠絡(luò)的提示異常信息:

由于內(nèi)部錯(cuò)誤,服務(wù)器無(wú)法處理該請(qǐng)求。有關(guān)該錯(cuò)誤的詳細(xì)信息,請(qǐng)打開服務(wù)器上的 IncludeExceptionDetailInFaults (從 ServiceBehaviorAttribute 或從 配置行為)以便將異常信息發(fā)送回客戶端,或在打開每個(gè) Microsoft .NET Framework 3.0 SDK 文檔的跟蹤的同時(shí)檢查服務(wù)器跟蹤日志。

于是做了一下修改:

  1. [ServiceBehavior(AddressFilterMode
    AddressFilterMode = AddressFilterMode.
    Any, 
    IncludeExceptionDetailInFaults = true)]  
  2. public class CommunicationWithUnit : 
    IContractForUnit  
  3. {...} 

 

其中第一個(gè)是去防火墻的,第二個(gè)是客戶端顯示錯(cuò)誤詳細(xì)信息的。

 

主要還是數(shù)據(jù)大小問(wèn)題,于是又去解決:

在WCF配置文件進(jìn)行修改.

舊的WCF配置文件:

 

  1. < binding name="BasicHttpBinding_
    ICentaMiddleService"
     closeTimeout="00:01:00" 
  2. openTimeout="00:01:00" receiveTimeout=
    "00:10:00" sendTimeout="00:01:00" 
  3. allowCookies="false" bypassProxyOnLocal=
    "false" hostNameComparisonMode="StrongWildcard" 
  4. maxBufferSize="65536" maxBuffer
    PoolSize
    ="524288" maxReceivedMessageSize="65536" 
  5. messageEncoding="Text" textEncoding=
    "utf-8" transferMode="Buffered" 
  6. useDefaultWebProxy="true"> 
  7. < readerQuotas maxDepth="32" 
    maxStringContentLength="8192" 
    maxArrayLength="16384" 
  8. maxBytesPerRead="4096" maxName
    TableCharCount
    ="16384" /> 
  9. < security mode="None"> 
  10. < transport clientCredentialType=
    "None" proxyCredentialType="None" 
  11. realm="" /> 
  12. < message clientCredentialType=
    "UserName" algorithmSuite="Default" /> 
  13. < /security> 
  14. < /binding> 

 

新的WCF配置文件:

 

  1. < binding name="BasicHttpBinding_
    ICentaMiddleService"
     closeTimeout="00:01:00" 
  2. openTimeout="00:01:00" receiveTimeout=
    "00:10:00" sendTimeout="00:01:00" 
  3. allowCookies="false" bypassProxyOnLocal=
    "false" hostNameComparisonMode="StrongWildcard" 
  4. maxBufferSize="65536" maxBufferPoolSize=
    "524288" maxReceivedMessageSize="9223372036854775807" 
  5. messageEncoding="Text" textEncoding=
    "utf-8" transferMode="Streamed" 
  6. useDefaultWebProxy="true"> 
  7. < readerQuotas maxDepth="6553500" 
    maxStringContentLength="2147483647" 
  8. maxArrayLength="6553500" maxBytesPerRead=
    "6553500" maxNameTableCharCount="6553500" /> 
  9. < security mode="None"> 
  10. < transport clientCredentialType="None"
     proxyCredentialType="None" 
  11. realm="" /> 
  12. < message clientCredentialType="UserName" 
    algorithmSuite="Default" /> 
  13. < /security> 
  14. < /binding> 

 

以上就是針對(duì)文件上傳大小控制對(duì)WCF配置文件進(jìn)行的修改方法。

責(zé)任編輯:曹凱 來(lái)源: 百度博客
相關(guān)推薦

2010-02-22 10:18:18

WCF配置文件

2010-02-23 14:17:20

WCF配置文件

2010-02-23 17:30:41

WCF部署于IIS

2010-02-24 14:10:54

WCF修改App.co

2009-11-05 10:30:41

WCF Address

2009-12-21 13:06:05

WCF Address

2011-03-28 09:07:26

Nagios配置文件

2010-02-22 17:58:06

WCF異步上傳

2009-11-09 13:31:09

WCF服務(wù)端配置

2010-02-24 11:22:04

WCF方法重載

2021-07-05 12:09:58

Python編程語(yǔ)言

2022-11-10 09:05:18

Lua配置文件

2010-03-19 11:18:07

Python讀寫配置文

2010-11-12 09:44:59

Cassandra配置

2010-03-01 17:39:07

WCF Address

2010-02-26 16:05:14

寄宿WCF服務(wù)

2010-03-30 18:04:45

Nginx http服

2009-12-21 18:10:50

WCF實(shí)現(xiàn)事件通知

2021-07-13 05:47:40

GroovyJSON軟件開發(fā)

2009-06-24 08:57:14

InittabLinux配置
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)