3

我有带有 basicHTTPBinding 的 WCF 客户端。在 Windows 中运行时运行良好。但是从 Mono(Debian 2.10.8.1-5,Mono JIT 编译器版本 2.10.8.1)运行时,我立即超时。

Unhandled Exception: System.TimeoutException: The operation has timed-out.
  at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TimeoutException: The operation has timed-out.
  at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0

我已经检查过它不是网络连接问题,因为它是从其他(基于 Windows 的)客户端运行的。此外,应用程序不会等待设置的 1 分钟超时。

这是我用来调用服务的代码:

// Application Authentication
DiscoveryService.LDEDiscoveryServiceClient client = new DiscoveryService.LDEDiscoveryServiceClient();
client.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(1);
Console.WriteLine("Connecting to: " + client.Endpoint.Address.Uri);
string token = client.GetTokenV1();
Console.WriteLine(token);

以及用于绑定配置的 app.config:

<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_ILDEDiscoveryService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
                <binding name="BasicHttpBinding_ILDEDeviceService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://hostname/LDE/DiscoveryService/LDEDiscoveryService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILDEDiscoveryService" contract="DiscoveryService.ILDEDiscoveryService" name="BasicHttpBinding_ILDEDiscoveryService"/>
            <endpoint address="http://hostname/LDE/DeviceService/LDEDeviceService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILDEDeviceService" contract="DeviceService.ILDEDeviceService" name="BasicHttpBinding_ILDEDeviceService"/>
        </client>
    </system.serviceModel>
</configuration>
4

0 回答 0