繁体   English   中英

WCF服务配置问题

[英]Wcf service configuration issue

我创建的WCF服务出现问题。 问题并没有在所有客户端上出现-即在某些系统上它不能正常工作在其他客户端上。

错误1:已超过传入消息的最大消息大小配额(65536)。 要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。

错误2:在某些系统上,操作合同未正确暴露。 运营合同中出现红色符号。 而且无法使用wcftestclient调用它。

配置文件:

<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>

现在,我在wcftestclient中获取客户端配置,以获取错误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>

服务工作时的客户端配置:

<?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>

请提出不同机器上服务行为不同的原因可能是什么。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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