Error to start service from Matlab in WebService

0

I'm building a web service that use a matlab class. I have export from matlab program my HRVAS.dll, then I have add it on my Project. To use this class I must include also MWArray.dll.

So if I try to start my project, I have this error:

    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

Now if I try to set in Build section of the project Platform Target X86, I can start my Web Service nerver error, but if I try to call one method at this line code:

 matlab = new Hrvas();

Hrvas is my dll from matlab, I have this error:

    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 ()"

Where is the error ?

matlab
rest
asked on Stack Overflow Oct 25, 2018 by bircastri • edited Oct 25, 2018 by bircastri

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0