简体   繁体   English

该进程无法访问文件.exe,因为它正在被另一个进程使用

[英]The process cannot access the file .exe because it is being used by another process

I am running a server socket project trying to listen in the port 2201. When I run the project for the first time it works properly and I got the message: 我正在运行一个服务器套接字项目,试图监听端口2201。当我第一次运行该项目时,它可以正常运行,并且得到以下消息:

"Waiting for a connection..." “正在等待连接...”

When I am closing the project and trying to re-run I am receiving the following message: 当我关闭项目并尝试重新运行时,我收到以下消息:

error CS2012: Cannot open 'C:...\\...\\...sockets.exe' for writing -- 'The process cannot access the file 'C:...\\...\\...sockets.exe' because it is being used by another process.' 错误CS2012:无法打开'C:... \\ ... \\ ... sockets.exe'进行写入-'该进程无法访问文件'C:... \\ ... \\ ... sockets。 exe”,因为它正在被另一个进程使用。

sockets is the name of the project. sockets是项目的名称。 What is happening here? 这是怎么回事

EDIT: Can I create a stopListening method with parallel with the startListening() method? 编辑:我可以创建一个与startListening()方法并行的stopListening方法吗? I got the same message when server isn't listening. 服务器不监听时,我收到相同的消息。

You are trying to re-compile it and for that reason the file must be open for writing. 您正在尝试重新编译它,因此,该文件必须打开才能写入。 Probably the program is not terminated, only its window is hidden and for that reason it is locked by OS. 程序可能没有终止,只有它的窗口被隐藏了,因此它被OS锁定了。 How you are "closing the project"? 您如何“关闭项目”?

Are you possibly not disposing of a method properly? 您是否可能无法正确处置方法? Like with streams you can wrap them in a using statement so they dispose correctly. 与流一样,您可以将它们包装在using语句中,以便正确处理。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 进程无法访问 exe 文件,因为它正被另一个进程使用 - The process cannot access the exe file because it is being used by another process “进程无法访问该文件,因为它正被另一个进程使用”与图像 - “The process cannot access the file because it is being used by another process” with Images 该进程无法访问文件“ XXX”,因为它正在被另一个进程使用 - The process cannot access the file 'XXX' because it is being used by another process 该进程无法访问文件XXX,因为它正在被另一个进程使用 - The process cannot access the file XXX because it is being used by another process SSIS - 该进程无法访问该文件,因为它正被另一个进程使用 - SSIS - The process cannot access the file because it is being used by another process DownloadFile该进程无法访问文件,因为该文件正在被另一个进程使用 - DownloadFile The process cannot access the file because it is being used by another process 该进程无法访问该文件,因为它正在被另一个进程使用 - The process cannot access the file because it is being used by another process 该进程无法访问该文件,因为它正在被另一个进程使用 - The process cannot access the file because it is being used by another process 该进程无法访问文件“路径”,因为它正在被另一个进程使用 - The process cannot access the file 'path' because it is being used by another process “进程无法访问该文件,因为它正由另一个进程使用” - “The process cannot access the file because it is being used by another process ”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM