进程占用其他服务的端口. [英] Process occupy other service‘s port.

查看:87
本文介绍了进程占用其他服务的端口.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该进程由Windows服务启动,然后我停止该服务.当我想再次启动它时,Windows显示该端口已被占用.它被Windows服务启动的进程占用.我真的很困惑.

我想知道进程为什么占用了服务所需的端口.

解决方案



停止服务时,请正确关闭端口,并丢弃所有物品.
如果您提供一些编码,那么我可以为您提供正确的编码说明.
真的很简单.只需关闭端口即可.它将解决您的问题.


请注意,Windows服务的概念是其他进程的宿主.在许多情况下,该服务是作为实际服务过程的控制者而实施的.后来的这个是独立的.停止服务不会自动终止子进程.应该,但是没有保证.
如果这是您编写的服务,则建议您重写代码以不使用子进程,而仅使用该服务中的线程.如果这是您要从应用程序控制的第三方服务,则可以收集它的子PID并尝试通过其pid停止子进程,或者如果它没有响应,则将其杀死.

The process is started by the windows service, then I stop the service.When I want to start it again,windows shows that the port was occupied. And it is occupied by the process which is started by the windows service. I really confused.

I want to know why the process occupied the port which the service needs.

解决方案

Hi,

While stopping the service properly close the port and dispose off the objects if any.
If you give a bit of coding then I can help you out properly with coding explanations.
Its really simple. Just close the port. It''ll solve your problem.


Be aware that the concept of service in windows is a host of an other process. In many cases the the service is implemented as berly a control oveer the actual servicing process. And this later one is a stand-alone. Stoping the service will not kill automatically the child process. It should, but there is no garantee.
If this is a service you wrote, I suggest rewrite the code not to use child process, only a thread in the service. If this is a third party service you want to control from your application, you can gather it''s child PID and try to stop the child process by it''s pid, or kill it if it does not respond.


这篇关于进程占用其他服务的端口.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆