小编Kev*_*Kev的帖子

WCF服务中的缓冲区大小

我们有一个WCF服务,它执行某些存储过程并将结果返回给silverlight客户端.某些存储过程最多返回80K行.

下面给出了web.config for Service中的设置

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <behaviors>
       <serviceBehaviors>
           <behavior name="MyService.MyServiceBehavior">
               <serviceMetadata httpGetEnabled="true"/>
               <serviceDebug includeExceptionDetailInFaults="true"/>
               <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
           </behavior>
       </serviceBehaviors>
    </behaviors>
    <bindings>
       <basicHttpBinding>
           <binding name="BasicHttpBinding_MyService" 
                maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" 
                receiveTimeout="00:40:00" openTimeout="00:40:00" 
                closeTimeout="00:40:00" sendTimeout="00:40:00">
                <readerQuotas maxDepth="2147483647" 
                    maxStringContentLength="2147483647" maxArrayLength="2147483647" 
                    maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
                <security mode="None"/>
           </binding>
        </basicHttpBinding>
        <customBinding>
           <binding name="MyService.MyService.customBinding0">
              <binaryMessageEncoding/>
              <httpTransport/>
            </binding>
        </customBinding>
     </bindings>
     <services>
          <service behaviorConfiguration="MyService.MyServiceBehavior" 
                   name="MyService.MyService">
              <endpoint name="BasicHttpBinding_MyService" 
                  address="" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="BasicHttpBinding_MyService" 
                  contract="MyService.IMyService"/>
           </service>
     </services>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

这对客户而言

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
    <behaviors>
       <serviceBehaviors>
           <behavior name="MyService_Behavior">
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <serviceMetadata httpGetEnabled="true"/>
           </behavior>
       </serviceBehaviors>
       <endpointBehaviors>
          <behavior name="r1">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/> …
Run Code Online (Sandbox Code Playgroud)

c# silverlight wcf

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

silverlight ×1

wcf ×1