COMException exception is thrown when an unrecognized HRESULT is returned from a COM method call." data-guid="6fffbb9f1b13ca675066e3ef4057a393">当 COM 方法调用返回一个无法识别的 HRESULT 时,将引发 COMException 异常。

检查该异常的 ErrorCode 属性,以确定 COM 对象返回的 HRESULT

COMException exception, which includes a public ErrorCode property that contains the HRESULT returned by the call." data-guid="d7af2dce64dc133b8cf5fc4b60580caa">当运行时遇到不熟悉的 HRESULT 时,会引发 COMException 异常,该异常包含一个公共的 ErrorCode 属性,其中含有调用所返回的 HRESULT。 如果运行时有可用错误信息,则将相应信息返回调用方。 但是,如果 COM 组件开发人员未能包含错误信息,则运行时返回八位数的 HRESULT 代替消息字符串。 拥有 HRESULT 使调用方能够确定异常的原因。 How to: Map HRESULTs and Exceptions." data-guid="89ba5841a53333901be1ab7220488607">有关更多信息,请参见 如何:映射 HRESULT 和异常

禁用宿主进程。

COM 用于在 Visual Studio 和宿主进程之间进行通信。 CoInitializeSecurity causes this exception to be thrown." data-guid="6829042bcbf788339b5858dfb782853b">因为它是在代码运行前使用的,所以调用 CoInitializeSecurity 将引发此异常。

备注

公共语言运行时 (CLR) 将已知的 HRESULTS 转换成 .NET 异常,这使 COM 对象能够将有意义的错误信息返回托管客户端。 HRESULTS 到异常的映射还可以反向工作,即将特定的 HRESULT 返回到非托管客户端。

COMException exception may be thrown when the objects are COM objects." data-guid="4f207b2f96974eb85ac5e295d1c289e1">将后期绑定参数传递给 Microsoft Office 对象的方法以后,如果这些对象是 COM 对象,则可能引发 COMException 异常。 ByRef parameter and that the property you pass has a Set accessor." data-guid="36905b328deb0670aad358f7a1a8c229">后期联编程序假定:此类方法调用涉及 ByRef 参数,并且所传递的属性具有 Set 访问器。 MissingMethodException exception (HRESULT CORE_E_MISSINGMETHOD)." data-guid="e7d4209accd14e61fa697749aea3781b">如果相应属性不具有该访问器,则 .NET Framework 生成一个 MissingMethodException 异常 (HRESULT CORE_E_MISSINGMETHOD)。 要处理此行为,请使用早期绑定对象或传递变量而不是对象的属性。

关于异常的疑难解答:System.Runtime.InteropServices.COMException的更多相关文章

  1. excel System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E

    System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E ...

  2. “System.Runtime.InteropServices.COMException”类型的第一次机会异常在 System.Windows.Forms.dll 中发生

    最近做一个winform项目,在里面用了webbrowser控件进行html文档打印,遇到了标题所示问题.根据查到的一些资料,在调试>异常>查找中输入“System.Runtime.Int ...

  3. “System.Runtime.InteropServices.COMException”类型的第一次机会异常在 ESRI.ArcGIS.Version.dll 中发生

    “System.Runtime.InteropServices.COMException”类型的第一次机会异常在 ESRI.ArcGIS.Version.dll 中发生 其他信息: The speci ...

  4. “System.Runtime.InteropServices.COMException (0x80070422): 无法启动服务”解决方法

    应用程序中发生了无法处理的异常.如果单击“退出”,应用程序将立即关闭.无法启动服务,原因可能是已被禁用或其相关联设备没有启动.(异常来自HRESULT:0X80070422).点击详细内容:有关调用实 ...

  5. System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472

    更新至服务器后运行出错: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472 解决方法 注册 ...

  6. System.Runtime.InteropServices.COMException (0x800706BA) 解决方法

    提示“操作失败:无法获取MAC地址.”错误的解决方法. .NET 获取 MAC地址可能会遇到   System.Runtime.InteropServices.COMException (0x8007 ...

  7. Visual Studio 2008 – ASP.NET “System.Runtime.InteropServices.COMException”

    The Issue When openning an existing ASP.NET project for the first time in Visual Studio 2008 it retu ...

  8. VS2008,System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))

    在VS2008环境中编译调试运行不报错,但在发布的exe文件运行就报错 System.Runtime.InteropServices.COMException (0x800401F3): Invali ...

  9. System.Runtime.InteropServices.COMException (0x800A03EC): 无法访问文件

    使用Microsoft.Office.Interop.Excel 操作 今天在服务器部署,操作程序csv文件转xsl文件的时候,遇到一下问题: System.Runtime.InteropServic ...

  10. System.Runtime.InteropServices.COMException 检索COM类工厂中CLSID{xxxxxxxxx}的组件时失败解决方法

    iis7.5中设定应用程序池中<进程模型>中<标识>为localSystem 提示:System.Runtime.InteropServices.COMException: 命 ...

随机推荐

  1. 利用多线程资源竞争技术上传shell

    通过多线程资源竞争的手段同时上传两个头像,就可以在Apache+Rails环境下实现远程代码执行.这并不是天方夜谭,同时我相信许多文件上传系统都会有这个漏洞……这是一个非常有趣的安全实验,一起来看看吧 ...

  2. iOS 颜色选择器 仿ps 调色板

    前几天写东西,需要到调色板,自己网上搜了一下,好多都写得很麻烦,自己手敲了一个,使用很简单,飞虎不多说,上图,上代码,上使用教程,希望大家喜欢,(基于xcode7.0版本) 最后更新于15/12/14 ...

  3. Hibernate 配置详解(2)

    6) hibernate.session_factory_name: 配置一个JNDI名称,通过Configuration对象创建的SessionFactory会绑定到JNDI下该名称中.一般名字格式 ...

  4. C# Linq-Aggregate

    The easiest to understand definition of Aggregate is that it performs an operation on each element o ...

  5. Unity 动态载入Panel并实现淡入淡出

    unity版本:4.5 NGUI版本:3.6.5 参考链接:http://tieba.baidu.com/p/3206366700,作者:百度贴吧 水岸上 动态载入NGUI控件,这里用Panel为例说 ...

  6. appendGrid

    appendGrid appendGrid的使用

  7. 【转】 Android开发之EditText属性详解

    原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...

  8. Delphi WebService连接数据库

    1. 图如下: 个人测试  客户端 1. 2.

  9. 从大学开始学C++到现在的一些感悟

    Since I choose this road, I will not regret it.     --Mereyct 端午过后的第二天,闲着没事,更新一下博客. 写这个博客的原因是,看到了群里有 ...

  10. 浅谈二维RMQ

    针对一些二维区间最值问题,用一维RMQ来解决显然是不够的.所以,要改进算法.鉴于网上没有PASCAL版的RMQ标程与解析,所以小可在这里简单的讲一下. 核心思想和一维的一样,只是在计算区间时略有不同. ...