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.

MATLAB Runtime

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:

  1. Right-click My Computer, and then click Properties.
  2. Click the Advanced tab.
  3. Click Environment variables.
  4. 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:

  1. Uninstall the other MWArrays from the GAC (so you make sure it picks up the referenced MWArray)
  2. 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

 

最新文章

  1. iOS 从某个页面返回然后刷新当前页面
  2. SQL SERVER 导出数据,数据与结构,结构
  3. Spring JPA Junit 关闭自动回滚
  4. AC日记——无线网络发射器选址 洛谷 P2038
  5. C# ManualResetEvent的使用
  6. 查看django里所有的url
  7. Html.ActionLink 几种重载方式说明及例子
  8. ios常用的一些类库
  9. jQuery中对 input 控件的操作
  10. Spark技术内幕:Stage划分及提交源代码分析
  11. Ubuntu16.04安装xampp及部署Testlink
  12. 最短路(spfa)
  13. RedHat系列软件管理(第二版) --脚本安装
  14. [Abp vNext 源码分析] - 文章目录
  15. Python 第八阶段 学习记录之---算法
  16. 712. Minimum ASCII Delete Sum for Two Strings
  17. dbca建库--linux上使用vnc图形化安装oracle10g版本
  18. CSS入门(二)
  19. char与unsigned char的区别
  20. 黄聪:wordpress教程

热门文章

  1. Java SubString截取字符串
  2. 浏览器输入URL按回车后都经历了什么?
  3. mysql 判断某字段是否包含中文
  4. 成功解决android studio打包报错
  5. Layer For Mobile 弹窗 input输入文字后,点击取消确定按钮失效(需点击两次)
  6. getfacl
  7. webStrom访问只一个很简单的html文件的时候显示local host无法访问。。
  8. poj 1151 (未完成) 扫描线 线段树 离散化
  9. jdk1.7安装和配置
  10. LG1912 [NOI2009]诗人小G