【问题标题】:System.Runtime.InteropServices.COMException: The device is not readySystem.Runtime.InteropServices.COMException:设备未准备好
【发布时间】:2015-07-30 20:15:26
【问题描述】:

我在 C# 应用程序中使用第三方库 (DigitalOfficePro),它在后台使用 Microsoft Interop。此应用程序将 powerpoint 演示文稿转换为 html 文件。
在本地环境中,这可以正常工作。在远程服务器上,我收到以下错误:

2015-07-30 11:46:00,584 [10] 错误 Mintra.Publisher.DocumentConverter.Core.Presentation.Conversion.HtmlConversion.Convert(:0) (null) - System.Exception: 文件转换期间出错\VIRT-PUB-STAGIN\converter_shared\ppt\Beerenberg_manual0_CellGlassCutting.ppt' 到输出位置 'D:\converter_shared\converted\ppt\Beerenberg_manual0_CellGlassCutting' 正在改版! ---> System.Runtime.InteropServices.COMException:设备未准备好。 ---> System.IO.IOException:设备未准备好。 在 System.IO.__Error.WinIOError(Int32 错误代码,字符串可能全路径) 在 System.IO.Directory.InternalCreateDirectory(字符串 fullPath,字符串路径,对象 dirSecurityObj,布尔检查主机) 在 System.IO.Directory.InternalCreateDirectoryHelper(字符串路径,布尔检查主机) 在 System.IO.Directory.CreateDirectory(字符串路径) 在 DigitalOfficePro.Html5PointSdk.PresentationConverter.c1234c1700677d6aa7d432fdb965c78bb(字符串 c7fc9d9edb8de5e2eb0df0a4b94c9b98d) 在 DigitalOfficePro.Html5PointSdk.PresentationConverter.Convert(字符串 outputFileNameWithPath) --- 内部异常堆栈跟踪结束 --- 在 DigitalOfficePro.Html5PointSdk.PresentationConverter.Convert(字符串 outputFileNameWithPath) 在 Mintra.Publisher.DocumentConverter.Core.Presentation.Conversion.HtmlConversion.Convert(字符串 pptInputFileName,字符串 htmlOutputFileName) --- 内部异常堆栈跟踪结束 ---

知道可能是什么问题吗?

我的本​​地环境详情:
Windows 7 旗舰版 (64x)
Microsoft Office PowerPoint 2007
打开 XML SDK V2.5

远程环境详情:
Windows Server 2008 R2 (64x)
微软 PowerPoint 2010
打开 XML SDK V2.5

【问题讨论】:

  • 对我来说,您的设备(逻辑驱动器)D: 尚未准备好。
  • @C Sharper,你是对的。我的路径有问题(错误的驱动器号)。请发布这个带有提示的答案,以检查代码如下: if (!new DriveInfo(@"D:\").IsReady){Log.Error("Drive D is not ready!!!"); } 我会接受这个作为答案

标签: c# powerpoint office-interop


【解决方案1】:

对我来说,您的设备(逻辑驱动器)D: 似乎还没有准备好。

            var driveInfo = new DriveInfo("D"); // or "D:\"

            if (driveInfo.IsReady)
            {
                // do your stuff..
            }
            else
            {
                // loggin, show to the user or throw an exception..
            }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-29
    • 1970-01-01
    相关资源
    最近更新 更多