在ASP.NET中使用32位Delphi dll? [英] Using 32 bit Delphi dll in ASP.NET?

查看:84
本文介绍了在ASP.NET中使用32位Delphi dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,当我进行测试时,它在Visual Studio 2010中可以正常工作。

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

但是我尝试了以下4种方法在64位Windows 7上发布到IIS7中,但是仍然无法正常工作:

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

1.Visual Studio 2010发布->构建->常规->平台目标:任何CPU

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

1-A:IIS7:ASP.Net v4.0,启用32位应用程序= False

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,启用32位应用程序= True

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

它甚至根本没有加载, Internet Explorer无法显示网页,并且应用程序日志中出现应用程序错误...。 p>

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


  1. Visual Studio 2010发布->构建->常规->平台目标:x86

2-A:IIS7:ASP.Net v4.0,启用32位应用程序= False

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. 

程序集加载跟踪:以下信息有助于确定程序集 WebApplicationTest为什么不能被执行

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,启用32位应用程序= True

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

完全不会再加载。

嗯..据我研究,唯一的方法是强制IIS7在32位进程中运行ASP.NET ...但是它似乎不起作用,我想知道我做错了什么...

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...

谢谢预先...

推荐答案

似乎正在发生的事情是,当您切换到32位时,无法找到32位版本一些其他依赖项。似乎正在找到这些其他依赖项的64位版本。

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.

如果可以安排所有DLL和程序集均为32位,则您尝试的工作应该可以进行。

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

另一个选择是使用FreePascal来构建64位DLL。如果接口是普通的旧函数,这可能会起作用,但是我不确定FreePascal是否可以执行COM。

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.

另一种方法是避免完全使用Delphi并使用工具支持64位,例如Visual Studio。

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

这篇关于在ASP.NET中使用32位Delphi dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆