Click here to Skip to main content
15,888,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
When Create Object Of DLL(Matlab) and Run Visual Studio No Error
But When Running That Is IIS That's Error Pm Below And Can't Run In IIS
Please Help Me To Fix That

C#
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Source Error: 


Line 22:         protected void Button1_Click(object sender, EventArgs e)
Line 23:         {
Line 24:             itd = new tdg.tdgITurboDIAG();
Line 25:             Response.Write(itd.ToString());
Line 26:             PI = itd.Initialize();

Source File: c:\Users\m.yarian\Desktop\WebApplication1\WebApplication1\WebApplication1\WebForm1.aspx.cs    Line: 24 

Stack Trace: 


[BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)]
   MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2(Int32 primaryMode) +0
   MathWorks.MATLAB.NET.Arrays.MWArray..cctor() +375

[TypeInitializationException: The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception.]
   MathWorks.MATLAB.NET.Utility.MWMCR..cctor() +1294

[TypeInitializationException: The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.]
   tdgNative.tdg..cctor() +46

[TypeInitializationException: The type initializer for 'tdgNative.tdg' threw an exception.]
   tdgNative.tdg..ctor() +0
   WebApplication1.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\Users\m.yarian\Desktop\WebApplication1\WebApplication1\WebApplication1\WebForm1.aspx.cs:24
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804


What I have tried:

how to run dll in iis version 6.1
Posted
Updated 9-Oct-16 1:07am
Comments
[no name] 9-Oct-16 6:29am    
You are probably trying to use a 64 bit application in a 32 bit world.

1 solution

With IIS 6.x, when you set the 'enable32BitAppOnWin64' flag, you actually turn IIS into 32 bit host as whole... There is no way to define different pools with different configuration - this can be done on IIS 7 or newer...
As most IIS 6 machines install with that flag on by default, it is probably your problem...
So you have these options:
1. Use 32 bit MATLAB
2. Use newer IIS
3. Configure IIS to use 64 bit only...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900