使用Office Automation时检查Office进程是否挂起 [英] Check for hung Office process when using Office Automation

查看:125
本文介绍了使用Office Automation时检查Office进程是否挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Office Automation时是否可以检查Microsoft Office进程(即Word,Excel)是否已挂起?此外,如果该进程已挂起,是否有办法终止它?

解决方案

让我开始说,我不建议您在服务器上的服务中这样做,但我会尽力回答这些问题. /p>

作为服务运行很难清理.例如,使用您作为服务运行的服务,可以杀死一个常识或擅长的语言.您可能必须终止服务.如果word或excel处于这种状态,您的服务会停止吗?

尝试测试它是否被挂起的一个问题是,您的测试可能会导致一个新单词实例启动并工作,而服务正在运行的那个实例仍会被挂起.

确定它是否挂起的最佳方法是要求它执行应做的事情并检查结果.我需要更多地了解它的实际作用.

在批处理文件中有一些用于清理的命令(均应在路径中):

  • sc停止服务名称-停止名为服务名称的服务
  • sc启动服务名-启动名为服务名的服务
  • sc查询服务名-查询服务名的状态

  • taskkill/F/IM excel.exe-终止excel.exe的所有实例

Is there a way to check to see if an Microsoft Office process (i.e. Word, Excel) has hung when using Office Automation? Additionally, if the process is hung, is there a way to terminate it?

解决方案

Let me start off saying that I don't recommend doing this in a service on a server, but I'll do my best to answer the questions.

Running as a service makes it difficult to clean up. For example with what you have running as a service survive killing a hung word or excel. You may be in a position to have to kill the service. Will your service stop if word or excel is in this state.

One problem with trying to test if it is hung, is that your test could cause a new instance of word to startup and work, while the one that the service is running would still be hung.

The best way to determine if it's hung is to ask it to do what it is supposed to be doing and check for the results. I would need to know more about what it is actually doing.

Here are some commands to use in a batch file for cleaning up (both should be in the path):

  • sc stop servicename - stops service named servicename
  • sc start servicename - starts service named servicename
  • sc query servicename - Queries the status of servicename

  • taskkill /F /IM excel.exe - terminates all instances of excel.exe

这篇关于使用Office Automation时检查Office进程是否挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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