【问题标题】:matlab code on IIS not workingIIS上的matlab代码不起作用
【发布时间】:2017-05-08 05:48:40
【问题描述】:

我使用的是 VS2013、Matlab 2015Ra 和 IIS 10。Net 框架是 4.5.2,EF 是 6。Matlab 2015Ra、VS2013 和 IIS 在 Windows 10 上是 64 位,也是 64 位。我将 MatLab 脚本编译为网络程序集。当我使用开发服务器时,程序可以正常工作而没有错误,而当它部署在 IIS 上时,程序无法执行 MatLab 代码并出现以下异常消息:

无法初始化 MATLAB 运行时实例 segv - 严重错误

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.ApplicationException:无法初始化 MATLAB 运行时实例 segv - 严重错误

完整的堆栈跟踪是:

    [ApplicationException: The MATLAB runtime instance could not be initialized
    segv - SEVERE ERROR] MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentId, String componentPath, Stream embeddedCtfStream, Boolean isLibrary) +282

    [Exception: The MATLAB runtime instance could not be initialized]
    MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentId, String componentPath, Stream embeddedCtfStream, Boolean isLibrary) +736
    BuildCrop.Cropper..cctor() +390

    [Exception: MWArray assembly failed to be initialized]
    BuildCrop.Cropper..ctor() +43
    EMS.Controllers.AdministratorController.Test_CreateCrop() +186
    lambda_method(Closure , ControllerBase , Object[] ) +87
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext 
    controllerContext, IDictionary`2 parameters) +229

 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
  System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67  
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod (IAsyncResult asyncResult)+42
  System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
  System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386   
  System.Web.Mvc.Async.AsyncControllerActionInvoker. EndInvokeActionMethodWithFilters  (IAsyncResult  asyncResult) +42
  System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
  System.Web.Mvc.Async.<>c__DisplayClass21.
  <BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction (IAsyncResult asyncResult) +38
  System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
  System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
  System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
  System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38   
 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication. IExecutionStep.Execute() +399
 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157

我查看了各种解决方案和文章,还尝试了 Leon 在 https://www.mathworks.com/matlabcentral/answers/29604-issues-with-iis-6-and-matlab-runtime 和 L. Mar 在 http://do-the-right-things.blogspot.com.au/2011/06/caveat-in-using-matlab-dll-in-aspnet.html 上提出的解决方案

我还在 IIS 中增加了 server.scripttimeout,但出现了相同的错误消息。

PS:Matlab 安装在服务器上,并且 dll 是从同一个 Matlab 创建的。

【问题讨论】:

  • 通常像 MatLab 这样的额外程序会使用某种运行时库,如果您没有安装,那将无法正常工作 - 例如,它可能需要 Visual c++ 运行时库 2015。检查需要哪些额外库它并安装它。
  • 我已经检查了我的系统 MS Visual C++ 2015(x86) 已安装。你指的是同一个运行时。我也关注了 mes100.com/blog/fix-algorithms-comgeometry-error> 并清除了系统中的缓存。仍然不起作用。如果有人知道这件事。
  • 我不知道它可能需要什么运行时库——如果是这种情况,你需要找出 0

标签: c# asp.net matlab iis deployment


【解决方案1】:

更新

所以如果有人遇到同样的情况,我会解释我是如何解决的,这样可以节省一些时间。此错误与 mcrcachex.x 尤其相关(在我的情况下为 mcrcache8.5,因为我使用的是 Matlab 2015a)。当从 C:\Users\\AppData\Local\Temp\\ 移动这个文件夹时,不要删除它的内容,因为“.mcr_cache_index”在某种程度上很重要。在删除之前,将此文件“.mcr_cache_index”复制到安全的地方,并在环境变量中创建 MCR_CACHE_ROOT 并提供 c:\mcrcahex.x 的路径后,将您保存以供以后使用的“.mcr_cache_index”文件粘贴到 c:\ 上的此文件夹中mcrcahex.x 路径。稍后您可以从以前的路径中删除 mcrcachex.x,以便 mcr 在执行时不会再次查看这些文件夹。还提供对其的访问权限,以便编译器可以在其中创建文件。

【讨论】:

  • 这仍然发生在 MatLab 2018a 中,不仅在 ISS 下,谢谢你救了我这一天。
猜你喜欢
  • 2015-03-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多