开发者

wcf client config not getting values from server app.config

I have defined maxBufferSize = 2147483647, maxBufferPoolSize = 2147483647, maxReceivedMessageSize = 2147483647 in the server config file but when i generate client config file, values for all these parameters are defaulted in there and i have to edit them manually. This is how i generate the client config file

svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config net.tcp:/
/localhost:4365/MyService

Also since i am using maximum values in the maxBufferSize, maxBufferPoolSize, maxReceivedMessageSize and maxItemsInObjectGraph, is that going to hit the performance?

--Server config values--

    <bindings>
      <netTcpBinding>
        <binding name="MySvc_InsecureTcp" closeTimeout="00:01:10"  openTimeout="00:01:10" receiveTimeout="24.20:31:23.6470000"
                        listenBacklog="1000" maxConnections="1000" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None">
            <transport protectionLevel="None" />
          </security>
        </binding>
        <bindi开发者_StackOverflow社区ng name="MySvc_mexBinding" closeTimeout="00:01:10"  openTimeout="00:01:10" receiveTimeout="24.20:31:23.6470000"
                        listenBacklog="1000" maxConnections="1000" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None">
            <transport protectionLevel="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>


    <behaviors>
      <serviceBehaviors>
        <behavior name="MyService">

          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceThrottling maxConcurrentCalls="30" maxConcurrentInstances="2147483647" maxConcurrentSessions="30" />
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>

<services>

      <service name="MyNameSpace.MyService" behaviorConfiguration="MyService">
        <endpoint address="" binding="netTcpBinding" contract="MyNameSpace.IMyService"
                  bindingConfiguration="MySvc_InsecureTcp" name="netTcpMySvc" >
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>

        <endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"
                  bindingConfiguration="MySvc_mexBinding" name="mexMySvc"  />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:4365/MyService"/>
          </baseAddresses>
        </host>

      </service>
    </services>

--After doing some more testing--

maxItemsInObjectGraph doesnt get included in the client config file. And if client is sending large objects, maxItemsInObjectGraph should be changed manually.

<behaviors>
  <endpointBehaviors>
    <behavior name="FASTServiceBehaviour">
      <dataContractSerializer  maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </endpointBehaviors>
</behaviors>


Not every configuration value defined on the service is passed to the client through metadata. Buffer sizes and reader quotas are one example because each participant in the communication can setup its own values - those values are defense against Denial of Service attack and can differ between service and client based on exchanged messages. For example if you want only upload large data sets you must set them correctly on the service but you don't need to modify them on the client. Downloading has reverse effect.


This is normal. Those properties are limited to that configuration file and don't carry across the service. Clients and servers can have different size limits, largely to help protect the sever against outrageously long requests (that the client might be expecting).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜