Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
281 views
in Technique[技术] by (71.8m points)

Using 32 bit Delphi dll in ASP.NET?

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 APPPOOLASP.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:inetpubwwwrootTestDllin
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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...