2

最近、メッセージの先頭に 1 回、メッセージの最後に 1 回、メッセージ内のヘッダーをランダムに 2 回返す wcf サービス呼び出しに問題がありました。これは私がフィドラーを通して見ているものの例です:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 16 Feb 2012 15:48:22 GMT
Content-Length: 308

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><Person_UpdateLastCSIDResponse/></s:Body></s:Envelope>HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 126
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

これは常に発生するわけではありませんが、ランダムに発生しているようです。特定のサービス コールだけで発生するのではなく、どのコールでも発生する可能性があります。まだパターンを特定できていません。

Silverlight アプリケーションでロード バランサーを介してバインディング タイプ basicHttpBinding を使用しています。

編集:

かなり基本的な構成があります。

サービス側:

<system.serviceModel>
 <extensions>
  <behaviorExtensions>
    <add name="silverlightFaults" type="Website.Support.SilverlightFaultBehavior, Website" />
  </behaviorExtensions>
 </extensions>
 <behaviors>
  <serviceBehaviors>
   <behavior>
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="true" />
   </behavior>
  </serviceBehaviors>
 </behaviors>
 <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />
 <services>
  <service name="Website.Services.CommonService">
   <endpoint address="" behaviorConfiguration="SilverlightFaultBehavior"
    binding="basicHttpBinding" bindingConfiguration="MyDefaultBinding"
    contract="Website.Services.CommonService" />
   <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
 <bindings>
  <basicHttpBinding>
   <binding name="MyDefaultBinding" maxBufferSize="6500000" maxReceivedMessageSize="6500000">
     <readerQuotas maxDepth="32" maxStringContentLength="52428800" maxArrayLength="52428800"
      maxBytesPerRead="4096" maxNameTableCharCount="52428800" />
   </binding>
  </basicHttpBinding>
 </bindings>
 <client />
</system.serviceModel>

クライアント側:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="SecureBinding" maxBufferSize="8388608" maxReceivedMessageSize="8388608">
                <security mode="Transport" />
            </binding>
        </basicHttpBinding>
    </bindings>

    <client>
      <endpoint address="https://Website/Services/CommonService.svc" binding="basicHttpBinding" bindingConfiguration="SecureBinding"
          contract="CommonSvcReference.CommonService" name="BasicHttpBinding_CommonService"/>
    </client>
</system.serviceModel>
4

1 に答える 1

1

私はついに私の問題を解決したと信じています。ロード バランサーを使用しているため、キープアライブを false にする必要があります。問題は、BasicHttpBinding の keep-alive が true であることです。customBinding に切り替えると、キープアライブをオフにすることができ、これで問題が解決しました。

拡張機能としてキープアライブを false にすると、アプリケーションの速度が低下しました。これを解決するために、http://blog.tonysneed.com/2012/06/18/building-scalable-and-secure-wcf-services/のサンプル コードを使用しました。

于 2012-06-20T14:50:04.703 に答える