我使用以下代码从我的应用程序中打开文档:
System.Diagnostics.Process.Start(fileName);
多年来,它一直运行得很好,在其他人的计算机上也运行得很好。
然而,我最近买了一台新电脑。在我的电脑上,它只工作一次:我点击按钮,文档就会打开。当我再次尝试做完全相同的事情时,我得到了这个错误:
Message: System.ComponentModel.Win32Exception (0x80004005): The specified procedure could not be found
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at Citadel.Products.Entity.ProductFactSheetDetail.DownLoad(String path, Boolean includeDateInFileName, Boolean addGuidToFileName, Boolean fileNameKeepSpaces, Boolean viewDocument)
at Citadel.Products.Entity.ProductFactSheetDetail.DownLoad(Boolean includeDateInFileName)
at Citadel.Products.Interface.Controls.FactSheetVersionSelectorControl.btnView_Click(Object sender, EventArgs e) in C:\Dev\Src\Tyrus\CodeBase\Development\Citadel.Products\Citadel.Products.Interface\Controls\FactSheetVersionSelectorControl.cs:line 81 - The specified procedure could not be found
Stack Trace: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at Citadel.Products.Entity.ProductFactSheetDetail.DownLoad(String path, Boolean includeDateInFileName, Boolean addGuidToFileName, Boolean fileNameKeepSpaces, Boolean viewDocument)
at Citadel.Products.Entity.ProductFactSheetDetail.DownLoad(Boolean includeDateInFileName)
at Citadel.Products.Interface.Controls.FactSheetVersionSelectorControl.btnView_Click(Object sender, EventArgs e) in C:\Dev\Src\Tyrus\CodeBase\Development\Citadel.Products\Citadel.Products.Interface\Controls\FactSheetVersionSelectorControl.cs:line 81
Application: Citadel.Tyrus
Version: 1.0.0.0
OSVersion: Microsoft Windows NT 6.2.9200.0
Description: 摆脱这个错误的唯一方法是重新启动我的应用程序。
很明显,这不是编码问题,我的电脑有些地方不对劲,但我不知道从哪里开始查找。任何帮助都将不胜感激。
编辑:错误不能与正在打开的文件有关。每当我们从数据库下载一个文件时,我们总是向文件名添加一个随机的Guid,以确保它是唯一的。
编辑:该问题似乎只出现在MS Office文档中。当我打开PDF文档或bmp时,没有出现错误。
发布于 2018-09-03 19:44:47
我想我终于通过重新安装.NET Framework解决了这个问题。(警告:这样做不适合胆小的人。(我是胆小的)如果你认为这是一个简单的卸载和重装的问题,请三思)
发布于 2018-08-30 16:03:18
https://stackoverflow.com/questions/52091938
复制相似问题