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. 3ds max 2016 新功能

    3ds max 2016 新功能_MCG节点编辑器 这是介绍视频下载: http://pan.baidu.com/s/1gds4wqJ

  2. C++例题1:输出可打印字符

    #include<iostream>#include<stdlib.h>#include<cctype>int main(){ int i;char a=0; fo ...

  3. Js使用word书签填充内容

    Js使用word书签填充内容 1.在模板文件中需要填充的地方插入书签 填充内容为:(|光标所在处) 填写书签名,点击添加完成: 2.使用js打开模板,获取书签位置,填充数据: function pri ...

  4. Unity3D研究院之异步加载游戏场景与异步加载游戏资源进度条

    Unity3D研究院之异步加载游戏场景与异步加载游戏资源进度条 异步任务相信大家应该不会陌生,那么本章内容MOMO将带领大家学习Unity中的一些异步任务.在同步加载游戏场景的时候通常会使用方法 Ap ...

  5. MongoDB入门简介

    MongoDB入门简介 http://blog.csdn.net/lolinzhang/article/details/4353699 有关于MongoDB的资料现在较少,且大多为英文网站,以上内容大 ...

  6. ASCII是指128个字符(不是256个)和ASCII Extended Characters(就是那些奇怪的外文字符)

    ASCII第一次以规范标准的型态发表是在1967年,最后一次更新则是在1986年,至今为止共定义了128个字元:其中33个字元无法显示(一些终端提供了扩展,使得这些字符可显示为诸如笑脸.扑克牌花式等8 ...

  7. Winform  隐藏程序窗口

    internal class HideOnStartupApplicationContext : ApplicationContext { private Form mainFormInternal; ...

  8. nginx 配置多个主机

    <pre name="code" class="html"> server { listen 8001; server_name localhost ...

  9. 数据结构(Splay平衡树):HAOI2008 排名系统

    [HAOI2008] 排名系统 [题目描述] 排名系统通常要应付三种请求:上传一条新的得分记录.查询某个玩家的当前排名以及返回某个区段内的排名记录.当某个玩家上传自己最新的得分记录时,他原有的得分记录 ...

  10. 【模拟】NCPC 2014 D Dice Game

    题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1790 题目大意: 两个人,每个人有两个骰子,每个骰子可以等概率取[a,b],问哪个人两 ...