当用户注销时,通过交互式用户的 Excel COM 自动化将停止工作

发布于 2024-10-03 17:21:43 字数 193 浏览 0 评论 0原文

我开发了一个服务器应用程序,它使用 Excel 2007 COM 自动化来转换一些 xls 文件。它作为 Windows 数据中心实例上的服务启动,在其自己的用户下运行,我必须更改 DCOM 安全设置(“作为交互式用户启动”)才能使其工作。

问题是,当我注销(通过 RDP)时,它停止工作。我登录,它又可以工作了。

有人遇到过同样的问题吗?

I have developed a server app that uses Excel 2007 COM automation to convert some xls files. It is started as a service on a Windows Datacenter instance, running under its own user, and I had to change DCOM security settings ("launch as interactive user") to make it work.

The problem is, when I log off (via RDP), it stops working. I log on, it works again.

Has anyone had the same problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

九歌凝 2024-10-10 17:21:43

好吧,如果没有交互式用户,我就无法让 Excel 运行,再多的 DCOMCNFG 欺骗也无济于事。因此,我只是为运行服务的用户配置了自动登录(请参阅 http://support.microsoft.com /kb/315231 获取说明)。

这会导致在服务器启动时,该用户将作为交互式控制台会话登录。与 RDP 会话不同,这是永久性的,并且让 Excel 满意。

对于必须执行类似操作的可怜灵魂的其他提示:

  • 创建文件夹 C:\Windows\System32[或 SysWOW64]\config\systemprofile\Desktop
  • 确保为在
  • 更改 DCOMCNFG 设置下运行的服务的用户配置默认打印机( mmc -32,添加 Excel 的“组件服务”)以使用交互式帐户运行
  • 更改全局 DCOM 默认值,以允许服务运行的用户进行本地访问、本地启动和本地激活

Ok, so I couldn't get Excel to operate without an interactive user, no amount of DCOMCNFG trickery would do. So I simply configured autologin for the user the service is running under (see http://support.microsoft.com/kb/315231 for instructions).

This has the effect that on server bootup, that user will login as an interactive console session. Unlike RDP sessions, this is permanent and makes Excel happy.

Other hints for the poors souls who have to do something similar:

  • create the folder C:\Windows\System32[or SysWOW64]\config\systemprofile\Desktop
  • make sure a default printer is configured for the user the service runs under
  • change DCOMCNFG settings (mmc -32, add "component services") of Excel to run using the interactive account
  • change global DCOM defaults to allow local access, local launch and local activation for the user the service runs under
无所的.畏惧 2024-10-10 17:21:43

服务器端:

A) 将“交互用户”切换为“此用户”

B) “此用户”仅在创建这些文件夹后才起作用:

  • C:\Windows\SysWOW64\config\systemprofile\Desktop
  • C:\Windows\System32\config\systemprofile\Desktop

C) 等待。 .. 步骤 B) 触发 Windows 自动创建:

  • C:\Users\Default\Desktop

请注意,“交互式用户”的定义是搭载服务器的活动登录用户。因此,当服务器上没有活动用户时,无法启动 MS Office。

也就是说,对我来说,该解决方案是已经提出的解决方案的混合体。我在 Win 2012R2 上使用 Office 2013 (x86)。我的问题是使用 Word(使用 WordToPDF)。

步骤 B 的详细信息:

  • 登录服务器 >开始>运行 DCOMCNFG.EXE(启动组件服务)>控制台根目录>组件服务>计算机>我的电脑> DCOM 配置...
  • 滚动到“Microsoft Word 97 - 2003 文档”或“Microsoft Excel 应用程序”(...即您需要启动的任何 MS Office 程序)...
  • 右键单击它并选择“属性”>“Microsoft Excel 应用程序”。身份选项卡>选择“此用户”>输入有权访问服务器上的 MS Office 的某些用户的凭据。 (我使用的是具有管理员权限的用户。)

步骤 C 的详细信息:

  • 等待时间从 5 分钟到过夜不等。或者,手动创建此文件夹(如果该文件夹不存在并且您急于完成测试)。

Server side:

A) Switch "Interactive User" to "This User".

B) "This User" only works after creating these folders :

  • C:\Windows\SysWOW64\config\systemprofile\Desktop
  • C:\Windows\System32\config\systemprofile\Desktop

C) Wait for it... Step B) triggers Windows to auto create:

  • C:\Users\Default\Desktop

Note the definition of "Interactive User" is to piggybacked on whatever is the active logged in user to the server. Thus failure to launch MS Office when no user is active on the server.

I.e., for me, the solution was a hybrid of the already proposed solutions. I used Office 2013 (x86) on Win 2012R2. My issue was instead with Word (to use WordToPDF).

Details for Step B:

  • Login to Server > Start > run DCOMCNFG.EXE (to launch Component Services) > Console Root > Component Services > Computers > My Computer > DCOM Config...
  • Scroll to “Microsoft Word 97 - 2003 Document” or "Microsoft Excel Application" (... i.e., whatever MS Office thing you need to launch)...
  • Right click it and select “properties” > Identity tab > Choose “This User” > enter credentials for some user with access to MS Office on the server. (I used a user with administrator permissions.)

Details for Step C:

  • The wait varies from 5 min to over-night. Optionally, create this folder manually (if the folder does not exist and you're in a rush to complete testing).
祁梦 2024-10-10 17:21:43

我遇到了这个问题,我发现答案实际上在 DCOM 配置中。

我执行了以下操作来解决该问题:

  1. 打开 Excel DCOM 属性,
  2. 转到 Identity code> 选项卡
  3. 选择此用户
  4. 输入有权访问 Excel 的人员的凭据

您可能需要转到安全 选项卡并确保您在上面指定的用户具有适当的权限权限。

完成此操作后,我能够注销服务器,同时仍然使用 Excel COM 自动化库。

I've had this issue, and I found that the answer is actually in the DCOM Configuration.

I did the following to resolve the issue:

  1. Open the Excel DCOM Properties
  2. Go to the Identity tab
  3. Select This User
  4. Enter the credentials of someone who has access to Excel

You may need to go to the Security tab and ensure the user you've specified above has appropriate Permissions.

After doing this, I was able to Log Off the Server while still using the Excel COM Automation libraries.

笔芯 2024-10-10 17:21:43

有一个叫做 Excel Services 应该可以使用 SharePoint 将 Excel 作为服务运行,这将允许它在无人登录的情况下无人值守地运行。

There's a thing called Excel Services which is supposed to make it possible to run Excel as a service using SharePoint, which would allow it to run unattended with nobody logged in.

一曲爱恨情仇 2024-10-10 17:21:43

如果运行 EXCEL 的帐户是管理员,则这将起作用:

对于 64 位 (x64),创建此文件夹:C:\Windows\SysWOW64\config\systemprofile\Desktop
对于 32 位 (x86),创建此文件夹:C:\Windows\System32\config\systemprofile\Desktop
否则要解决此问题,请按照下列步骤操作:

  1. 以管理员身份登录到您的服务器
  2. 转到“开始”->“ “运行”并输入“MMC comexp.msc /32”
  3. 转到 Microsoft Excel 应用程序的属性,在“身份”下,将其从“启动用户”(默认设置)更改为“交互用户”。
  4. 转到 Microsoft Office Excel 2007 工作簿的属性,在“身份”下,将其从“启动用户”(默认设置)更改为“交互式用户”。
  5. 转到 Microsoft Excel 应用程序的“安全”选项卡,然后选择“自定义”
    “启动和激活权限”并向其添加帐户(EXCEL 正在其下运行),并为其授予“本地启动”和“本地激活”权限
  6. 。转到 Microsoft Office Excel 2007 工作簿的“安全”选项卡,然后选择“自定义”
    “访问权限”并添加ACCOUNT(在其下运行EXCEL)并赋予其“本地访问”权限

If the account which is running EXCEL is administrator then this will work:

For 64-bit (x64), create this folder: C:\Windows\SysWOW64\config\systemprofile\Desktop
For 32-bit (x86), create this folder: C:\Windows\System32\config\systemprofile\Desktop
Otherwise To resolve this issue follow these steps:

  1. Login to your Server as a administrator
  2. Go to "Start" -> "Run" and enter "MMC comexp.msc /32"
  3. Go to the properties of Microsoft Excel Application, under Identity, change it to The Interactive User from The Launching User (which is set by default).
  4. Go to the properties of Microsoft Office Excel 2007 Workbook, under Identity, change it to The Interactive User from The Launching User (which is set by default).
  5. Go to Security tab for Microsoft Excel Application and select Customize for
    " Launch and Activation Permissions" and add ACCOUNT (under which EXCEL is running) to it and give it "Local launch" and "Local Activation" permission
  6. Go to Security tab for Microsoft Office Excel 2007 Workbook and select Customize for
    " Access Permissions " and add ACCOUNT (under which EXCEL is running) to it and give it "Local Access" permission
晨曦慕雪 2024-10-10 17:21:43

这解决了我的问题。 Windows 10 安全更新已应用于服务器,这是问题首次发生的时间。更改交互式用户设置后,一切又恢复正常。

this fixed my issue. Windows 10 security uodates were applied to the server which is when the issue first started happening. After changing the interactive user setting everything worked as usual once again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文