C# WCF主机正在丢失连接
我真的需要一些好的方法来解决我遇到的罕见的头痛问题 背景是为了满足客户的需求,我开发了一个FileTransfer wcf服务,用于在internet和企业内部网之间传输文件,因此在那里我使用Windows服务来托管它,提供了两个协议:http和tcp,前者用于internet数据传输,后者用于内部网。但是,不幸的是,Windows服务主机处于恶意网络状态,更具体地说,它会随机失去连接 为了传输大文件,我将sendtimout、receivetimeout、opentimeout和closetimeout设置为一个相对较大的值,如“00:30:00”,但有时如果连接丢失或不稳定,它必须等待很长一段时间才能发送响应 有什么想法或棘手的解决方案吗C# WCF主机正在丢失连接,c#,wcf,C#,Wcf,我真的需要一些好的方法来解决我遇到的罕见的头痛问题 背景是为了满足客户的需求,我开发了一个FileTransfer wcf服务,用于在internet和企业内部网之间传输文件,因此在那里我使用Windows服务来托管它,提供了两个协议:http和tcp,前者用于internet数据传输,后者用于内部网。但是,不幸的是,Windows服务主机处于恶意网络状态,更具体地说,它会随机失去连接 为了传输大文件,我将sendtimout、receivetimeout、opentimeout和closeti
<?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>
但是,不幸的是,Windows服务主机处于恶意网络状态,更具体地说,它会随机断开连接。如果实际连接断开,那么配置超时将没有帮助。容忍失败。分块传输文件。是的,它是以块的形式发送的,比如每次100*1024字节,但我的意思是,是否有可能因为大超时设置,一旦连接丢失,它必须等待足够长的时间才能获得超时错误,然后自动移动到处理下一个块?可能吧