不关闭C#Windows应用程序

不关闭C#Windows应用程序

本文介绍了不关闭C#Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#Windows应用程序。我把它放在一个测试服务器,其设立是不是由我公司控制,无论是seurity背景上。我双击exe文件。应用程序运行,我看到我的状态。我关闭应用程序,我打开任务管理器,我仍然看到applicatiion的脚印。

I have a C# windows application. I placed it on a test server, whose set up is not controlled by my company and neither is the seurity context. I double click the exe. App runs and i see my form. I close the application, i open task manager and i still see a foot print of the applicatiion.

TASKKILL似乎并没有删除它,它仍然是在任务管理器中运行。

taskkill does not seem to remove it and it is still running in task manager.

我如何检查是否仍被关押的任何资源?

how do i check if any resource is still being held?

推荐答案

可能的原因是,你的应用程序关闭后在后台线程仍在运行。根据你的架构和应用程序配置后台线程会导致进程,以保持主窗口关闭后运行。

The likely cause is that a background thread is still running after your application is closed. Depending on your framework and application configuration a background thread can cause a process to keep running even after the main window is closed.

你有你的进程的线程?如果是的话请务必关闭他们出来的时候,主应用程序窗口正在关闭。一个好地方,做到这一点是在Windows窗体

Do you have any threads in your process? If so make sure to close them out when the main application window is closing. A good place to do this is in the OnClosing method of a Windows Form

这篇关于不关闭C#Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:48