Using 32 bit Delphi dll in ASP.NET?

徘徊边缘 提交于 2019-12-25 01:06:49

问题


First, it working fine in Visual Studio 2010 when I do the testing.

But I tried 4 of the following to publish into IIS7 on 64bit windows 7, but is still not working:

1.Visual Studio 2010 Publish -> Build -> General -> Platform Target: Any CPU

1-A: IIS7: ASP.Net v4.0, Enable 32-Bit Application = False

Error:
Server Error in '/TestDll' Application.
--------------------------------------------------------------------------------

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

1-B: IIS7: ASP.Net v4.0, Enable 32-Bit Application = True

It doesn't even load at all, "Internet Explorer cannot display the webpage" and Application log got Application Error....

  1. Visual Studio 2010 Publish -> Build -> General -> Platform Target: x86

2-A: IIS7: ASP.Net v4.0, Enable 32-Bit Application = False

Could not load file or assembly 'WebApplicationTest' or one of its dependencies. An attempt was made to load a program with an incorrect format. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'WebApplicationTest' could not be loaded.

=== Pre-bind state information ===
LOG: User = IIS APPPOOL\ASP.NET v4.0
LOG: DisplayName = WebApplicationTest
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: WebApplicationTest | Domain ID: 7
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/inetpub/wwwroot/TestDll/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\TestDll\bin
Calling assembly : (Unknown).

2-B: IIS7: ASP.Net v4.0, Enable 32-Bit Application = True

Doesn't load at all again.

hmm.. from what I research is that the only way is to force IIS7 to run the ASP.NET in 32 bit process...but it doesn't seems working, I wonder what did I done wrong...

Thanks in advance...


回答1:


What appears to be happening is that when you switch to 32 bit you fail to locate 32 bit versions of some other dependencies. It appears to be finding the 64 bit versions of those other dependencies.

If you can arrange that all your DLLs and assemblies are 32 bit, what you are attempting should work.

Another option is to use FreePascal to build a 64 bit DLL. This might work if the interface is plain old functions, but I'm not sure that FreePascal can do COM.

Yet another route would be to avoid Delphi altogther and use tools that support 64 bit, e.g. Visual Studio.



来源:https://stackoverflow.com/questions/5718616/using-32-bit-delphi-dll-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!