iisexpress.exe: Access violation reading location when calling native code DLL in web app only

2

I'm calling native code dll (delphi) procedure(parameterless) from asp.net app and getting 'Access violation reading location' exception from iisexpress.exe for that [name].dll. Code works perfectly fine in Windows forms app.

I've checked for possible windows Bitness issue. Dll is built under win64. Asp Web app and iis express settings are also set to x64 from app properties. Parameter type incompatibility is ruled out, because the procedure is parameterless and it is not returning anything either. I also gave 'Everyone' all permissions to the dll. The same code of calling same dll works in .net Windows forms application. It is not working on Windows server IIS either.

delphi dll native code:

procedure test() stdcall;
begin       
end;

exports 
  test;

Asp.net c# code calling DLL:

[DllImport("name.dll", CharSet = CharSet.Unicode, 
           CallingConvention = CallingConvention.StdCall)]
public static extern void test();
protected void Page_Load(object sender, EventArgs e)
{           
     test();                       
}

Winforms.net c# working code calling same DLL:

[DllImport("name.dll", CharSet = CharSet.Unicode, 
           CallingConvention = CallingConvention.StdCall)]
public static extern void test();
private void button3_Click(object sender, EventArgs e)
{
     test();
}

Exception I'm getting for asp.net app: Exception thrown at 0x000000000040D289 (name.dll) in iisexpress.exe: 0xC0000005: Access violation reading location 0x000002756568CCB0.

Looks like it has something to do with IIS since it is working on Winforms app perfectly, but I'm not sure what.

c#
asp.net
delphi
dll
asked on Stack Overflow Oct 23, 2019 by Lev • edited Oct 24, 2019 by Dharman

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0