.net 调用 Matlab生成dll出现的问题(The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.)
https://cn.mathworks.com/matlabcentral/answers/278399-i-get-an-error-saying-the-type-initializer-for-mathworks-matlab-net-utility-mwmcr-threw-an-except
这篇文章帮忙解决了问题
记录一下备忘:
Hi Nug,
Ensure that you have the MCR version corresponding to MATLAB 2012b installed. You can check that from the following link.
After ensuring that you have the correct version of MCR, it will be useful to check the system path. If you have either MATLAB or any other version of MCR installed on your machine, please make sure that the one you are running the deployable against appears higher in the system path than any other MATLAB/MCR runtime.
To view or change environment variables:
- Right-click My Computer, and then click Properties.
- Click the Advanced tab.
- Click Environment variables.
- In the 'System Variables' search for the variable named 'Path' and ensure that the MCR installation for R2012b appears higher than in the path than any other MATLAB/MCR runtime
Also, are you using the Web installed MCR or the packaged MCR?
There might be two possible causes for the error to appear:
A) This error can appear if you copied the MATLAB Runtime DLL mclmcrrt8_0.dll to the folder that contains your .NET application or to some other Windows system folder. If you copy this MATLAB DLL to another folder, when it tries to find its further dependencies it will fail.
To work around this issue, remove any unnecessary copies of the file and leave the file in the installation folder belonging to MATLAB or the MCR.
B) The issue might be due to the fact that the packaged MCR installation is not adding the MWArray properly to the machine Global Assembly Cache (GAC). So in such a case, the deployed component picks up the older MWArray already installed in the GAC and fails. The GAC preempts other references so even if you specifically reference the R2015a MWArray by browsing to it and referencing it in Visual Studio, it may not work.
In order to workaround this issue you would need to either:
- Uninstall the other MWArrays from the GAC (so you make sure it picks up the referenced MWArray)
- Add the R2012b MWArray into the GAC using Microsoft's gacutil.exe. More information about this can be seen from the link below :
http://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.110).aspx
I hope either of the above workarounds helps you to resolve this issue.
-Rohit
.net 调用 Matlab生成dll出现的问题(The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.)的更多相关文章
- Matlab生成.dll文件在.NET中加载失败与平台的关系及解决方案
问题链接地址:http://bbs.elecfans.com/forum.php?mod=viewthread&tid=207995
- asp.net下调用Matlab生成动态链接库
对于这次论文项目,最后在写一篇关于工程的博客,那就是在asp.net下调用matlab生成的dll动态链接库.至今关于matlab,c/c++(opencv),c#(asp.net)我总共写了4篇配置 ...
- WPF调用C++生成的dll文件(示例)
注:笔者使用的VS版本为2019.1.打开VS2019,选择文件 -> 新建 -> 项目 2.选择项目 新建项目时选择C++“控制台应用”语言:C++平台:Windows项目类型:空项目 ...
- c++调用matlab生成的Dll动态连接库
点击打开链接http://download.csdn.net/detail/nuptboyzhb/4228429 c++调用matlab生成的Dll动态连接库 实验平台: matlab 7.0(R ...
- C#调用Matlab生成的dll方法
其实整个过程比较简单,但是需要心细一点. 需要的工具:VS2005及以上版本,MATLAB2008B及以上版本,另外非常重要的需要安装一个MATLAB Compiler Runtime,这个文件(MC ...
- C#调用Matlab生成的Dll
问题描述:最近开发需要调用matlab生成的DLL,在New MWNumericArray 对象的时候报错,提示未将对象引用到对象的实例. 问题分析:因为MWArray.dll是Matlab提供的DL ...
- c++与matlab联合编程,调用Deploytool 生成exe文件和dll文件(转)
转自:http://www.cnblogs.com/xlw1219/archive/2012/12/25/2832222.html 首先必须知道联合编程需要知道的一些命令解释: mcc 的作用是将 . ...
- MATLAB中.m文件生成.dll
1.配置编译环境 在命令行窗口输入: mbuild -setup 如果出现以下提示信息说明成功: 如果提示信息为: 错误使用mbuild(line 164) Unable to complete su ...
- C# 调用WebService的3种方式 :直接调用、根据wsdl生成webservice的.cs文件及生成dll调用、动态调用
1.直接调用 已知webservice路径,则可以直接 添加服务引用--高级--添加web引用 直接输入webservice URL.这个比较常见也很简单 即有完整的webservice文件目录如下图 ...
随机推荐
- day35-python 操作memcache二
Memcache常用命令 存储命令: set/add/replace/append/prepend/cas 获取命令: get/gets 其他命令: delete/stats.. add方法 添加一条 ...
- GDT全局描述符表
GDT全局描述符表 什么是GDT全局描述符表 GDT全称为Global Descriptor Table,全局描述符表. 保护模式的寻址方式不在使用寄存器分段的方式直接寻址方式了.而采用的是使用GDT ...
- Backpack VI
Given an integer array nums with all positive numbers and no duplicates, find the number of possible ...
- Code::Blocks环境下导入WS2_32.lib文件
打开菜单选项中 Settings -> Compiler 点击Add 找到lib文件的路径,导入 点击OK--OK,完成!
- 简述servlet
什么是Servlet? Servlet是一种动态的web开发技术,本质就是一个运行在服务端的Java小程序,负责处理业务逻辑,生成动态web内容. 编写一个servlet步骤: 1.编写一个类 继承 ...
- 马凯军201771010116《面向对象程序设计(java)》第七周学习总结
理论与知识部分 多态性:概念:指在程序中同一符号在不同的情况下具有不同的解释.超类中定义的域或方法,被子类继承之后,可以具有不同的数据类型或表现出不同的行为.这使得同一域或方法在超类及各个子类中具有不 ...
- mysql中外键的创建与删除
外键的创建 方法1:创建表的时候设置(外键名随机生成) 1.前提条件,必须要有一个主表,这里设为persons 2.主表中必须设置主键字段primary key,这里设为id_p //创建数据库dat ...
- 构建gulp项目
express是node.js中的构建工具,如果需要使用express构建,首先需要安装express. 构建一个项目: |-- app| |-- css| |-- js| | `-- class| ...
- Python学习笔记第二十六周(Django补充)
一.基于jQuery的ajax实现(最底层方法:$.jax()) $.ajax( url: type:''POST“ ) $.get(url,[data],[callback],[type]) #c ...
- requests模块的使用
requests模块 什么是request模块:requests是python原生一个基于网络请求的模块,模拟浏览器发起请求. requests-get请求 # get请求 import reques ...