Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Process.Start、Thread.IsBackGround、BackgroundWorker和.Net.Remoting_C#_Multithreading_Backgroundworker_.net Remoting_Process.start - Fatal编程技术网

C#Process.Start、Thread.IsBackGround、BackgroundWorker和.Net.Remoting

C#Process.Start、Thread.IsBackGround、BackgroundWorker和.Net.Remoting,c#,multithreading,backgroundworker,.net-remoting,process.start,C#,Multithreading,Backgroundworker,.net Remoting,Process.start,我需要一个建议,因为我被“锁定” 我有一个客户端-服务器应用程序,在客户端进程和服务器进程之间使用.NetRemoting。 服务器进程向调用方法的客户端引发事件。 然后,客户端使用BackGroundWorker将值传输到用户界面。 通常,启动客户端时服务器已经在运行。 -调用BackGroundWorker.DoWork()时,Thread.CurrentThread.IsBackground等于True -在BackGroundWorker_RunWorkerCompleted事件中,T


我需要一个建议,因为我被“锁定”

我有一个客户端-服务器应用程序,在客户端进程和服务器进程之间使用.NetRemoting。
服务器进程向调用方法的客户端引发事件。
然后,客户端使用BackGroundWorker将值传输到用户界面。

通常,启动客户端时服务器已经在运行。
-调用BackGroundWorker.DoWork()时,Thread.CurrentThread.IsBackground等于True
-在BackGroundWorker_RunWorkerCompleted事件中,Thread.CurrentThread.IsBackground等于False

但是,如果在客户端加载(.exe正在打开)期间,它需要(使用Process.Start())打开服务器进程(.exe),然后才能连接
然后,在BackGroundWorker_RunWorkerCompleted中,Thread.CurrentThread.IsBackground仍然等于True,并且在此线程中无法更改UI。
在这种情况下,我需要打开另一个客户机(连接到同一台服务器)以获得良好的性能。


这两种情况之间有什么区别?
谢谢。

您应该拥有的:

客户:
--UI线程:启动BGWorker并运行BackgroundWorker.RunWorkerCompleted
--Backgroundthread:运行BackgroundWorker.DoWork,与服务器通信

服务器:与客户端通信

为什么在客户端启动时服务器还没有运行?+如果它们在同一台机器上运行,为什么要使用远程处理呢?

我找到了(a)解决方案: 在客户端启动中:

lChannelTCP = new TcpChannel(lProps, provider, providerSrv);
ChannelServices.RegisterChannel(lChannelTCP, false);
或者(没有测试哪一个)


必须在服务器进程启动之前设置

您是否正在非UI线程上创建BackgroundWorker?请参阅我的服务器是应用程序服务器。客户端是WinForm、Web浏览器或简单类。您可以访问一些图像,但演示文稿是法语的,我的UI也是法语的。对不起(翻译工作太多了)。
RemotingConfiguration.ApplicationName = "EDV";