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