问题标签 [comexception]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
14617 浏览

c# - 在 Outlook 2010 上访问电子邮件时出现 COMException

您好,我正在尝试通过 C# 控制台应用程序在 Outlook 2010 中访问我的电子邮件。

Visual Studio 以管理员权限启动,我添加了对 Outlook 的引用Microsoft.Office.Interop.Outlook v14.0.0.0并将其用作 Outlook。

我的代码:

第二行,抛出错误消息:

你知道有什么解决办法吗?

0 投票
0 回答
1540 浏览

.net - mshtml.HTMLInputElement.name COMException

在我们的 .NET 项目中使用引用时,我看到了类似的问题mshtml.dll,但与此特定情况无关。我怀疑这个问题可能与这个线程(.net document write with mshtml)中所说的有关在我的案例中缺少所有相关属性/属性的 coclass 有某种关系。这里的细节是我mshtml.HTMLInputElement在解析对象时使用的一组属性/属性WebBrowser.Document

}

以上在开发PC(VS2008 3.5 SP1)下工作正常,除了name属性之外,其他一些属性也被成功调用type,等等,但是当应用程序安装在具有所有必需框架部件的Windows 7下时,我得到COMException

===============

System.Runtime.InteropServices.COMException 越过了本机/托管边界 Message=Member not found。(来自 HRESULT 的异常:0x80020003 (DISP_E_MEMBERNOTFOUND))Source=mscorlib
ErrorCode=-2147352573 StackTrace:在 System.RuntimeType.ForwardCallToInvokeMember(字符串成员名称,BindingFlags 标志,对象目标,Int32 [] aWrapperTypes,MessageData 和 msgData)在 mshtml.DispHTMLInputElement.get_name( )

=======================

name对,等属性的调用type现在都不起作用。总是一样Interop.COMException的被抛出。在我看来,这与使用 mshtml 编写的 .net 文档中解释的问题相同。

有谁知道这个问题的有效解决方法?

0 投票
2 回答
3323 浏览

.net - 分配给 Excel.Application.ActivePrinter 时出现 COMException

我有一个函数,我向其中传递了一个 Microsoft.Office.Interop.Excel.Application 实例。该功能使用 Windows 的内置传真打印机或 Microsoft XPS Document Writer,将文件保存为 tiff 图像。

但是,当我尝试分配给应用程序的 ActivePrinter 属性时,会抛出带有以下消息的 COMException:

HRESULT 异常:0x800A03EC

这是代码:

使用的打印机都被确认为已安装/在注册表中。采用 Word 应用程序类的类似函数可以正常工作。我对 COM 相关的东西还很陌生,我觉得这可能只是我与 excel 相关的无知在起作用,但是在搜索 google/stackoverflow 时我几乎找不到任何与此相关的东西,除了一两个旧的、未回答的线程。有一些与大量数据/大范围有关,但与 ActivePrinter 属性无关

编辑 - 答案的简要总结,在 M Patel 的链接中有详细说明:

Excel 对设置它的 ActivePrinter 属性很挑剔。它不仅需要打印机名称,还需要打印机和端口,例如“Fax on Ne01:”。这个端口应该可以从注册表中获得,或者在:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices

或者

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Devices

使用链接中详述的方法,或者在我的情况下使用 Microsoft.Win32.Registry.GetValue()。后者将返回类似于“winspool,Ne01:”的内容。以“Fax on Ne01:”的方式将该字符串的最后一部分连接到打印机名称上,可以毫无例外地设置 ActivePrinter 属性。

我还应该注意到我的问题发生在 excel 2010

0 投票
1 回答
9263 浏览

.net - ClickOnce 安装生成错误:System.Runtime.InteropServices.COMException,无法加载运行时,来自 HRESULT 的异常:0x80131700

尝试通过 ClickOnce部署WPF项目时发生此错误:

[...file path...].application 的激活导致异常。检测到以下失败消息:无法加载运行时。(来自 HRESULT 的异常:0x80131700)

System.Runtime.InteropServices.COMException - 加载运行时失败。(来自 HRESULT 的异常:0x80131700)-来源:System.Deployment。

直到最近,该项目以 32 位 .NET Framework 4 Client Profile为目标,并顺利安装在所有机器上。然后我们不得不切换到 .NET Framework 4 完整配置文件,因为我们开始包含Crystal Reports,这不仅仅与客户端配置文件有关。

我们开始在客户端计算机上应用的 .NET Framework 4 完整配置文件安装程序针对 32 位和 64 位操作系统。但是,WPF 项目是专门为 32 位编译的,出于某种原因,我目前不记得了。部署应用程序的计算机运行 Windows 7 64 位企业版和 Service Pack 1。为了部署针对 .NET Framework 完整配置文件的新版本,我们首先在客户端计算机中安装了 Crystal Reports,还安装了 .NET Framework 4 完整配置文件那些只有客户端配置文件的机器,然后更新了 ClickOnce 安装程序供用户下载新应用程序。

首先要强调的是,WPF 应用程序的ClickOnce更新在某些机器上运行顺利,而对于其他机器,它在下载安装文件之后和安装之前就中断了。我们无法确定是什么造成了差异。

关于异常 0x80131700,有几个论坛出版物和博客提到安装 .NET Framework 3.5 Service Pack 1。但是,显然,安装中断的机器和更新正常的机器都安装了它。此外,我们无法获得带有 SP1 安装程序的 .NET Framework 3.5 版本:引导程序只是挂起,而完整的包在解压缩安装文件时会引发“文件损坏”异常!还值得注意的是,WPF 应用程序还需要 Microsoft .NET Framework 4 平台更新 1 - 运行时更新 (KB2478063),但自几个月前的第一个版本以来就是这种情况,我们对此没有问题前。

我们浏览了许多关于“System.Runtime.InteropServices.COMException”异常以及“加载运行时失败(HRESULT 异常:0x80131700)”异常的论坛和博客文章。但是到目前为止,我们还不能确定是什么让我们的应用程序的最新版本可以完美地安装在某些机器上,而我们在其他机器上得到上述行为,在一个显然所有机器都属于的环境中公司网络,共享几乎相同的配置。

而且我们也无法解决问题。

我现在将发布在尝试将我们的 WPF 应用程序安装在无法工作的机器上时生成的完整错误日志(它是西班牙语,抱歉):

0 投票
1 回答
2106 浏览

vb.net - Unable to Catch COMException ( VB.net Excel workbook.styles)

I'm using VB.net in MS Visual Studio 2012 to create an add-in for Excel (2010, 2007). The add-in uses Excel's Styles to format reports. Rather than iterate through the Styles collection, I thought it would be easier to try getting a reference to my style by name and catch the exception if it doesn't exist.

I keep getting Visual Studio's exception dialog for "COMException crossed a native/managed boundary" with the following details:

I have tried everything I could think of to catch this "simple" exception:

  1. the infamous catch-all "Catch ex As Exception", or "Catch"
  2. Googled various combinations of COMException, DISP_E_BADINDEX, workbook.styles, and several forms of "can't catch exception"
  3. verified the Thrown checkbox is NOT checked for COMException under Common Language Runtime Exceptions -> System.Runtime.InteropServices
  4. treating it as a Corrupt State Exception (CSE) by adding the HandleProcessCorruptedStateExceptions Attribute
  5. Checked Enable native code debugging in the Debug section of the Project Properties

I realize it may be better (and possibly even faster) to loop through entire Styles collection looking for a match to _TitleStyleName, but I would much prefer to understand why I've been unable to simply Catch this Exception.

Thank you for taking the time to read all this. :)

0 投票
0 回答
409 浏览

comexception - 尝试在 Windows Phone 8 中进行蓝牙连接时出现错误代码 2147500037

我正在尝试以编程方式建立应用到应用的蓝牙连接。出于上述目的,请参阅以下代码片段:

每当我尝试这样做时,我都会收到此错误:

请告知如何解决此错误。

0 投票
1 回答
290 浏览

mysql - 尝试在 Codesmith 中列出“视图”时使用 ODBC 的 COMException

我已经建立了到 MySQL 服务器的 ODBC 连接(Oracle 的 ODBC 驱动程序版本 5.1)。连接测试成功!如果我单击以显示数据库的表,它也会成功。现在我正在尝试显示 VIEWS 并收到以下错误:

尝试列出表列、键或索引时会发生类似错误:

附加信息:Windows 7、64 位 MySQL ODBC 5.1 驱动程序

我试图将 Codesmith 目录包含到我的 Windows PATH 环境变量中,但没有成功。有任何想法吗?你需要更多信息?

0 投票
0 回答
317 浏览

c# - WinrtXamlToolkit - 图表:使用 INotifyPropertyChanged 时出现 ComException

我目前正在使用折线图(来自 WinRT XAML 工具包),我遇到了一个问题:一切正常,但如果绑定到我的 LineSeries 的 (In)DependentValue 包含更改通知 (INotifyPropertyChanged),则工具包引发 COMException。

我使用了 Nuget 工具包的最新版本(1.4.1)。

我的 XAML 代码:

还有我的 C# 代码:

是否可以通过通知属性更新来更新图表?

请注意,如果我尝试直接编辑 LineDataPoint.DependentValue,则会发生相同的异常

0 投票
1 回答
2032 浏览

asp.net-mvc - 带有网络路径的 FilePathResult 引发 COMException(句柄无效)

我正在使用 FilePathResult 像这样:

我的路径是我们网络上其他地方的路径。这会导致服务器错误。当我检查服务器上的事件日志时,我可以看到这个错误条目:

同时,事件查看器中也会记录一个警告:

我运行应用程序的服务帐户对文件夹位置具有读取权限。我在 ASP.NET MVC 世界的其他地方没有发现这个问题,所以我想我会在这里问。

0 投票
1 回答
741 浏览

iis-7.5 - Can't Connect to IIS 7.5 from another 7.5

I am trying to execute this command from a web application on sourceServer:

var mgr = ServerManager.OpenRemote(destServer)

but I receive this error:

UnAuthorized access wth a detail error: "Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine failed due to the following error: 80070005"

I have full administrative rights on both servers.

I can issue that command from a console application no problem, but when I try it from the web application, I get the error!

I have tried enabling the remote management checkbox and started teh remote access auto connection manager and also tried updating the load user profile on the applicaiton pool from false to true.

I have searched so much to the point that all of my links are pink in color!

Any input is greatly appreciated.