Remote timeout

.NET remote use is used in my brownfield . We decided to set timeouts for our remote access methods.

System.Collections.IDictionary properties = new System.Collections.Hashtable();
properties["name"] = Ipc_Channel_Name;
properties["timeout"] = 1 * 1000;

IChannel clientChannel = new IpcClientChannel(properties, null);
ChannelServices.RegisterChannel(clientChannel, false);

The problem is that the timeout does not seem to work. I checked it by installing System.Threading.Thread.Sleep(5 * 1000);in the called code. Is the reason IpcClientChannel does not support timeouts?

How to set a timeout?

+3
source share
1 answer

- IpcClientChannel "-". "connectionTimeout" . . (MSDN). .

System.Collections.IDictionary properties = new System.Collections.Hashtable();
properties["name"] = Ipc_Channel_Name;
properties["connectionTimeout"] = 1 * 1000;

IChannel clientChannel = new IpcClientChannel(properties, null);
ChannelServices.RegisterChannel(clientChannel, false);
+4

Source: https://habr.com/ru/post/1725345/


All Articles