Why do I receive an error "Could not load file or assembly 'MWArray' or one of its dependencies" when attempting to run a 32-bit ASP.NET web application that calls a compiled .NET assembly, on a 64-bit server?

1 回表示 (過去 30 日間)
I have compiled my MATLAB code into a .NET assembly using MATLAB Builder NE 3.0.2 (R2009b), on a 32-bit Windows machine. This assembly is then added as reference to a .NET Web Application which is compiled for an x86 target. When this web application is deployed to a 64-bit ASP.NET server and executed, I see the following exception:
System.BadImageFormatException: Could not load file or assembly 'MWArray' or one of its dependencies. An attempt was made to load a program with an incorrect format.

採用された回答

MathWorks Support Team
MathWorks Support Team 2010 年 1 月 26 日
As described in the Relation Solution linked below, .NET assemblies produced by MATLAB Builder NE (any release) are compiled into Microsoft Intermediate Language (MSIL), which make them architecture-independent. However, the compiled assembly typically has other platform-dependent dependencies, such as DLLs or MEX-files which limit the architecture on which it can be invoked. Therefore, you may only add assemblies produced from 32-bit MATLAB as References to projects compiled for the x86 Platform.
Also, when executing a 32-bit web application on a 64-bit server, it is launched by a 64-bit worker process (w3wp.exe) by default. However, since a .NET assembly compiled on a 32-bit machine has 32-bit dependencies, it is necessary for it to be launched by a 32-bit worker process.
To resolve this exception, one of two workarounds can be used:
1) Compile the .NET assembly using 64-bit MATLAB Builder NE, so that its dependencies are all 64-bit binaries.
2) Enable your server to run worker processes in both 64-bit and 32-bit mode, and apply a filter so that 32-bit applications are always launched by a 32-bit worker process.
Note: You can verify whether a worker process is running in 32-bit mode by monitoring processes in the Task Manager. All 32-bit processes are listed with an asterisk (*) adjacent to their names.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeploy to C++ Applications Using mwArray API (C++03) についてさらに検索

製品


リリース

R2009b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by