zoukankan      html  css  js  c++  java
  • .net 中使用Excel library 11.0 COM Workbooks.Open 出现错误:System.MissingMethodException: 找不到方法

    这两天遇见一个奇怪的问题。
    在使用.Net调用Excel的booksOpen方法的时候,出错:

    找不到方法:Excel.Workbook Excel.Workbooks.Open(System.String, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)。

    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

    异常详细信息: System.MissingMethodException: 找不到方法:Excel.Workbook Excel.Workbooks.Open(System.String, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)。

    在网上搜了搜,发现出这种的错的情况,大多是编译的时候引用的Exce与运行环境中Excel版本不同造成的。
    不过,我是在本地编译,本地运行,应该不会有这种问题才对。

    我的Web程序引用了一个内库,内库引用Excel,并调用Excel的books open方法。
    如下结构:


    我在三台机器上测试,两台机器上,报找不到open方法,有一台正常。

    后来,我找到解决办法:在web应用程序项目中再次引用Excel Com,测试就正常了。

    不过,我仍不知道造成这种情况的确切原因是什么。


  • 相关阅读:
    linux 下spyder安装
    【C++】fill函数,fill与memset函数的区别
    【tensorflow使用笔记一】:安装linux下tensorflow环境的问题
    leetcode 49 字母异位词分组
    leetcode 1014. 在 D 天内送达包裹的能力
    【C++进阶:STL常见性质3】
    【C++进阶:STL常见性质2】
    【C++进阶:STL常见性质】
    【C++进阶:移位运算符的用法】
    面向对象之静态方法
  • 原文地址:https://www.cnblogs.com/king_astar/p/257846.html
Copyright © 2011-2022 走看看