3

アプリケーションc#に関連するwebServiceを作成しました。

すべての方法が完全に機能します。ただし、関数には「タイムアウト」の問題があります。このメソッドは、約[1,000,000](100万)の整数を持つ整数の配列を返すはずです データは正しく取得されますが、メソッドを呼び出してから約4〜5分です。100万の整数のテーブルを約5分待つのは正常ですか?私のアプリケーションでは、時間がかかりすぎて煩わしいことがあります。大きなデータを送信するための解決策またはより良い方法を知っていますか?

  • 他の圧縮方法?
  • その他の応答形式(xml、配列..)?

サーバー側の構成ファイルは次のとおりです。

Web.config

<?xml version="1.0"?>
<configuration>

  <system.web>
      <customErrors mode="Off"/>
      <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>

    <diagnostics performanceCounters="Default" />
    <bindings>
      <basicHttpBinding>
        <binding name="Elevation_ServiceSoap" closeTimeout="00:02:00" messageEncoding="Mtom"
          openTimeout="00:02:00" receiveTimeout="00:02:00" sendTimeout="00:02:00"
          allowCookies="true" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
        <binding name="BasicHttpBinding_IGeocodeService" allowCookies="true"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
        <binding name="BasicHttpBinding_IImageryService" allowCookies="true"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>

    <client>
      <endpoint address="http://gisdata.usgs.gov/XMLWebServices2/Elevation_Service.asmx"
        binding="basicHttpBinding" bindingConfiguration="Elevation_ServiceSoap"
        contract="ElevationService.Elevation_ServiceSoap" name="Elevation_ServiceSoap" />
      <endpoint address="http://dev.virtualearth.net/webservices/v1/geocodeservice/GeocodeService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeocodeService"
        contract="GeocodeService.IGeocodeService" name="BasicHttpBinding_IGeocodeService" />
      <endpoint address="http://dev.virtualearth.net/webservices/v1/imageryservice/imageryservice.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IImageryService"
        contract="ImageryService.IImageryService" name="BasicHttpBinding_IImageryService" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment - binaryHttp -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="10000000"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

クライアント側の構成ファイルは次のとおりです。

App.config

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" closeTimeout="00:02:00"
                    openTimeout="00:02:00" receiveTimeout="00:02:00" sendTimeout="00:02:00"
                    allowCookies="true" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
                    <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <behaviors >
            <serviceBehaviors>
                <behavior name="debug">
                    <serviceDebug includeExceptionDetailInFaults="true" />
                    <dataContractSerializer maxItemsInObjectGraph="10000000"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

        <client>
            <endpoint address="http://blalbloslblalbla/WebServiceArcadia_World_deploy/Service1.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                contract="WebServiceArcadia_World.IService1" name="BasicHttpBinding_IService1" />
        </client>
        <services>
            <service name="WebServiceArcadia_World_deploy.IService1">

            </service>
        </services>
    </system.serviceModel>
    <system.web>
        <httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
    </system.web>
</configuration>
4

4 に答える 4

1

各リクエストのデータを少なくするために、結果をページ分割するようにしてください。

于 2013-03-25T16:11:08.207 に答える
1

最も簡単な解決策は、結果をページ分割することです。WCFサービスから返される整数の制限(たとえば2000)を設定し、応答に0の数値が含まれるまで呼び出します。

于 2013-03-25T16:13:12.333 に答える
1

サービスとクライアントが同じPCで実行されている場合は、net.pipeバインディングを試してください。そうでない場合は、net.tcpバインディングを試してください。

于 2013-03-26T13:13:23.487 に答える
0

こんにちは。最後に、正しい解決策はエンコードモードを変更することでした!実際、デフォルトの[WCF]は、応答形式「xml」の全文を送信します。これはとてつもなく重いです!整数の配列を考案しました。インデックス/値ごとに[WCF]タグは、不要なテキストを次の形式で追加します。例。

XML

<!-- Too heavy with text / tag useless for the customer -->
<xmlns blabalala .........  />
<item>11</item>
<item>2</item>
<item>41</item>
.....

単純なバイナリ形式/またはJsonのはるかに軽いなど...:

11,2,41,2,6,7,34,8,43,12,76, .....

とにかく、ついにバイナリの送信方法を変更しました!エンコード方法の選択に大いに役立ち、ストリーミングなどを送信するページ!

マイクロソフトによる記事はこちら->大規模なデータとストリーミング-WCF

時々変化します!〜3分-〜3分30秒-〜4分...しかし、それはすでに少し良くなっています。残念ながら、[WCF]を使用してこれを高速化する方法は他にないと思います。そうでない場合は、「WebSocket」を使用するのが最善の解決策になります。私のアプリケーションでは、[wcf]を使用してハングアップしていました。ダウンロード中にprogressBarを追加できるように、メソッドでwebServiceアクセスモード「async」を追加すると思います。他のアイデアも歓迎します;-)

于 2013-03-26T13:09:02.667 に答える