我編寫c#代碼,以動態連接到WCF服務器。如果連接少於1分鐘,那麼它就是完美的。但是,如果遠程功能工作超過1-2分鐘,則拋出異常。這是我的代碼:動態WCF客戶端不會等待超過一分鐘
try
{
BasicHttpBinding basicHttpBinding = new BasicHttpBinding()
{
CloseTimeout = TimeSpan.FromMinutes(20),
OpenTimeout = TimeSpan.FromMinutes(20),
ReceiveTimeout = TimeSpan.FromMinutes(10),
SendTimeout = TimeSpan.FromMinutes(10)
};
EndpointAddress endpointAddress = new EndpointAddress("http://***");
IBrowserClicker personService = new ChannelFactory<IBrowserClicker>(basicHttpBinding, endpointAddress).CreateChannel();
Console.WriteLine(personService.TestConnect().Equals("Hello google!"));
}
catch (Exception exception)
{
Console.WriteLine("Error:"+exception);
}
例外:
Error:System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
那麼,它是如何解決?