私が遭遇しためったにない頭痛の問題に対するいくつかの良い解決策が本当に必要です.
背景は、クライアントの要件を満たすためです。インターネットと企業のイントラネットの間でファイルを転送するための FileTransfer wcf サービスを開発しました。そのため、Windows サービスを使用して、http と tcp の 2 つのプロトコルを提供してホストしました。後者はイントラネット用です。しかし、残念なことに、Windows サービス ホストは敵対的なネットワーク状態にあります。具体的に言うと、接続がランダムに失われます。
大きなファイルを転送するつもりで、sendtimout、receivetimeout、opentimeout、closetimeout を「00:30:00」のような比較的大きな値に設定しましたが、接続が失われたり不安定になったりすると、長時間待たなければならないことがありました。送信応答のサイクル。
アイデアやトリッキーな解決策はありますか?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Folder" value="C:\Share\Test"/>
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FileTransferHttpBinding" transferMode="Streamed" messageEncoding="Mtom" maxReceivedMessageSize="10067108864"
openTimeout="12:00:00" closeTimeout="12:00:00" receiveTimeout="12:00:00" sendTimeout="12:00:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="FileTransferTcpBinding" transferMode="Streamed" maxReceivedMessageSize="10067108864">
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="FileTransferServiceBehaviors" name="FileTransfer.FileTransferService">
<endpoint binding="basicHttpBinding" bindingConfiguration="FileTransferHttpBinding" contract="FileTransfer.IFileTransferService"/>
<endpoint binding="netTcpBinding" bindingConfiguration="FileTransferTcpBinding" contract="FileTransfer.IFileTransferService"/>
<endpoint address="mex" contract="IMetadataExchange" binding="mexTcpBinding" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8524/FileTransfer"/>
<add baseAddress="net.tcp://localhost:8525/FileTransfer"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="FileTransferServiceBehaviors">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>