从WebService中的Matlab启动服务时出错

时间:2018-10-25 08:55:37

标签: matlab rest

我正在构建一个使用matlab类的Web服务。我已经从matlab程序导出了我的HRVAS.dll,然后将其添加到了我的项目中。要使用此类,我还必须包括MWArray.dll。

因此,如果我尝试启动我的项目,则会出现此错误:

    Server error in the '/' application.
The file or assembly 'WSAnalisiHRV' or one of its dependencies could not be loaded. Attempt to load a program with an incorrect format.
Description: Unhandled exception when running the current Web request. For more information about the error and its point of origin in the code, see the stack trace.

Exception Details: System.BadImageFormatException: The file or assembly 'WSAnalisiHRV' or one of its dependencies could not be loaded. Attempt to load a program with an incorrect format.

Error in the source code:

An unhandled exception was thrown when the web request was executed. For information on the origin and location of the exception, see the exception stack trace below.

Assembly Load Trace: The following information can help you determine why the 'WSAnalisiHRV' assembly could not be loaded.



Stack trace:

    [BadImageFormatException: The file or assembly 'WSAnalisiHRV' or one of its dependencies could not be loaded. Attempt to load a program with an incorrect format.]
       System.Reflection.RuntimeAssembly._nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & ​​stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark & ​​stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName (AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark & ​​stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
       System.Reflection.RuntimeAssembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
       System.Reflection.RuntimeAssembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) +21
       System.Reflection.Assembly.Load (String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper (String assemblyName, Boolean starDirective) +38

现在,如果我尝试在项目Platform Target X86的Build部分中进行设置,则可以启动Web Service神经错误,但是如果我尝试在此行代码中调用一种方法:

 matlab = new Hrvas();

Hrvas是我来自matlab的dll,出现此错误:

    Message = "Attempt to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"
StackTrace: StackTrace = "in MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2 (Int32 primaryMode) \ r \ n in MathWorks.MATLAB.NET.Arrays.MWArray..cctor ()"

错误在哪里?

0 个答案:

没有答案