WCF - client proxy configuration does NOT match web.config service

I have a simple WCF service that needs to handle large data streams, so I have many configuration values ​​superimposed above the default values. I recently transferred all my code to a new, restructured solution, and I just switched to the service. However, when I try to create a client proxy (using WCFTestClient.exe or "Add service link" in VS2008, the values ​​in the client proxy configuration do not match what I set for this service.

This is the server configuration - pay attention to the increased values ​​of maxBufferSize, maxReceivedMessageSize, maxStringContentLength and MaxArrayLength

  <system.serviceModel>
    <bindings>    
      <basicHttpBinding>
        <binding name="default" maxBufferSize="5000000" maxReceivedMessageSize="5000000">
          <readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
          <!-- turn this setting on to require SSL/https -->
          <!-- <security mode="Transport" /> -->
        </binding>       
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Consent.Service.SubjectConsentServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="Consent.Service.SubjectConsentServiceBehavior"
        name="Consent.Service.SubjectConsentService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="default"
          contract="Consent.Service.ISubjectConsentService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>

Here is the proxy generated by VS2008 using the "Add Service Link"

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_ISubjectConsentService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://server/Consent/services/SubjectConsent.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISubjectConsentService"
            contract="ServiceReference1.ISubjectConsentService" name="BasicHttpBinding_ISubjectConsentService" />
    </client>
</system.serviceModel>

- 4 , .

, ?

+3
1

, , - ( , ), (, , Add Service Reference ") . (" " - WSDL , .)

, , .

+5

Source: https://habr.com/ru/post/1704860/


All Articles