Я создаю веб-сервис, который использует класс Matlab.У меня есть экспорт из программы 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
Теперь, если я пытаюсь установить в разделе Buildпроекта Platform Target X86, я могу запустить свою ошибку веб-службы, но если я попытаюсь вызвать один метод с этой строкой кода:
matlab = new Hrvas();
Hrvas - это моя dll из matlab, у меня есть эта ошибка:
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 ()"
Где ошибка?