简体   繁体   中英

Wcf service configuration issue

I am getting an issue with WCF service I have created. Issue is not coming on all clients - ie on some systems it is working others not.

Error 1: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

Error 2: On some system the operation contract is not exposed properly. A red symbol is coming across operation contract. And unable to call it using wcftestclient.

Config File:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" >
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
    <services>
      <service name="ExternalService.Service.MyDashboardService">
        <host>
          <baseAddresses>
            <add baseAddress = "http://****/ExternalService.Service/MyDashboardService/" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="ExternalService.ServiceInterface.IMyDashboardService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior>
                       <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                      <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

Now the client config I am getting in wcftestclient for Error 1:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMyDashboardService" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://****/ExternalService.Service/MyDashboardService/"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyDashboardService"
                contract="IMyDashboardService" name="BasicHttpBinding_IMyDashboardService" />
        </client>
    </system.serviceModel>
</configuration>

Client Config when service is working:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMyDashboardService" 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://****/ExternalService.Service/MyDashboardService/"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyDashboardService"
                contract="IMyDashboardService" name="BasicHttpBinding_IMyDashboardService" />
        </client>
    </system.serviceModel>
</configuration>

Please suggest what could be the reason for different behavior of service on different machines.

您应该在双方客户端和服务上使用相同的bindingConfiguration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM