From MATLAB to ASP.NET Web Forms Application/Web deployment - How to solve 'System.TypeInitializationException' error?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Marcus Vo
el 23 de Dic. de 2016
Comentada: BENELMIR WALID
el 29 de En. de 2018
I'm trying to get a simple addition function performed within MATLAB to work on a webpage with an ASP.NET Web Forms application, purely to see if the process works.
1. I use the Library Compiler to build the 'addNumbers.dll' along with the class 'AdditionClass' to instantiate .
2. Reference the 'addNumbers.dll' along with the 'MWArray.dll' in the the C#.
3. Run the web application, but a 'System.TypeInitializationException' in App_Web_XXX.dll errors occurs once the button to perform the addition is pressed.
MATLAB R2015a, x64 Windows 10. Changing the debug configuration to x64 within VS does not seem to solve it. Any help would be greatly appreciated.
'Add' button results in exception error and breaks.
Exception Detail: System.BadImageFormatException
Oddly enough, it does work with pretty much the exact same C# code and same .dll paths, except in a Windows Forms Application rather than a Web Form. This at least proves the correct .dll files are being referenced and the code is correct (presumably).
0 comentarios
Respuesta aceptada
Friedrich
el 28 de Dic. de 2016
Hi,
there are two pieces to the puzzle here. First the bittedness of the DLL you built and second the bittedness of the webserver. I assume you are using the ISS which VisualStudio starts for you when pressing play/run. Per default VS will host the 32bit ISS but you have a 64bit DLL which the webserver should load. In order to get this working you need to tell VS to start the 64bit ISS version. See here for how to do it. Basically go to Tools | Options | Projects and Solutions | Web Projects and check the "Use the 64 bit version of IIS Express…" option.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Compiler SDK en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!