简体   繁体   English

C# Win 应用程序,任务计划程序,用户帐户:系统。 Microsoft Excel 无法访问该文件

[英]C# Win App, Task Scheduler, User Account: System. Microsoft Excel cannot access the file

  1. Task Scheduler on a Windows server Windows 服务器上的任务计划程序
  2. User Account is System用户帐户是系统
  3. Starts a .NET windows app that reads an Excel file启动读取 Excel 文件的 .NET windows 应用程序
  4. Error:错误:

Microsoft Excel cannot access the file 'D:\Automation\02_14_25_.xlsx' There are several possible reasons: Microsoft Excel 无法访问文件 'D:\Automation\02_14_25_.xlsx' 有几个可能的原因:
• The file name or path does not exist. • 文件名或路径不存在。 • The file is being used by another program. • 该文件正被另一个程序使用。 • The workbook you are trying to save has the same name as a currently open workbook. • 您尝试保存的工作簿与当前打开的工作簿同名。

  1. I created the folder Desktop in C:\Windows\SysWOW64\config\systemprofile and C:\Windows\System32\config\systemprofile\ but still same error.我在C:\Windows\SysWOW64\config\systemprofileC:\Windows\System32\config\systemprofile\中创建了文件夹 Desktop,但仍然存在相同的错误。
  2. When I log in to the server as myself(administrator) and run the app, it runs without errors.当我以自己(管理员)身份登录服务器并运行应用程序时,它运行时没有错误。 Any suggestions please?请问有什么建议吗?

You did not clarify that the file: "D:\Automation\02_14_25_.xlsx"您没有说明文件:“D:\Automation\02_14_25_.xlsx”

Actually exists or if that is just the error message you could not correctly interpret.实际存在,或者这只是您无法正确解释的错误消息。

In that case my answer would be: Your application is not started with the correct environment variables if it runs as a scheduled task.在这种情况下,我的回答是:如果您的应用程序作为计划任务运行,则它没有使用正确的环境变量启动。 That is my classical mistake for the:这是我的经典错误:

"It works when i run it manually but it doesn't when i do it with cron/scheduled task." “当我手动运行它时它可以工作,但当我使用 cron/计划任务时它不起作用。” - Scenario - 设想

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

相关问题 用户登录系统中的密码问题。 C# - Issue with password in user login system. C# C# 错误:Microsoft Excel 无法访问文件“...”。 有几个可能的原因 - C# Error: Microsoft Excel cannot access the file '…'. There are several possible reasons Microsoft Office Excel 无法访问文件'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx' - Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx' 具有Excel Interop的C#控制台应用程序作为Windows计划程序/ ActiveBatch上的计划任务挂起 - C# Console App with Excel Interop hangs as a scheduled task on Windows scheduler/ActiveBatch C#中的任务计划程序 - Task Scheduler in c# Microsoft Excel无法访问文件'C:\\ 0BBAC500' - Microsoft Excel cannot access the file 'C:\0BBAC500' 从任务计划程序运行 C# 可执行文件时无法创建和保存 excel 文件 - Not able to create and save excel file when C# executable is run form Task Scheduler 使用Windows Task Scheduler运行时无法访问sql server db的C#应用 - C# app that does not access sql server db when run with windows task scheduler 在 C# 中系统启动时触发任务调度程序 - Task scheduler trigger when system boot in C# 无法使用SQL(OLEDB)C#写入Microsoft Access文件 - Cannot write to a Microsoft Access file using SQL (OLEDB) C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM