c# - visual studio Word Addin 需要超过 15 秒才能关闭 word

标签 c# visual-studio visual-studio-2012 vsto office-addins

我使用 visual studio 2012 开发了 Word 插件。.net 框架是 4.5。它工作正常。唯一的问题是,当用户关闭 word 文件时,在我们单击“x”后,word 大约需要 15 秒才能关闭。

它在我的机器上立即关闭。我的机器配置如下: - .Net 框架 4.5.2。 - VSTo 10.0.50903 和 - 操作系统是 windows 7 64 位。

虽然客户端计算机需要一些时间才能关闭(15 秒或更长时间)。客户端具有以下配置。 - Visual Studio 2010 tools for office runtime x64 版本为 10.0.50325.00 - 他们访问 word 的 Citrix 服务器操作系统。 Windows Server 2008 R2 企业版 SP1 64 位 - .Net Framework 版本? 4.5.2

他们没有安装任何其他插件。

谢谢!

最佳答案

尝试拦截 OnFormClosing 事件并执行以下操作

protected override void OnFormClosing(FormClosingEventArgs e)
{
   yourWordObject.Quit();
   System.Runtime.InteropServices.Marshal.FinalReleaseComObject(yourWordObject);
   base.OnFormClosing(e);

}

关于c# - visual studio Word Addin 需要超过 15 秒才能关闭 word,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27289194/

相关文章:

c# - 查找两个列表中的属性差异

c# - LINQ to 对象列表差异

visual-studio - Home键转到Visual Studio中的行首吗?

sql-server - SQL Server 2012 默认实例的连接字符串是什么?

c++ - 运行时如何在 Visual Studio C++ 中确定调试或 Release模式

将 Google Sheets API 与服务帐户一起使用时出现 C# 错误

c# - 循环动态 JSON 以获取所有节点 C#

visual-studio - "Find in Files"的替代方案

visual-studio - 如何在Ms cobol 2.20中调试

c - 堆损坏错误