Delphi XE2 64位ISAPI访问冲突
Windows Server 2008 R2 64位 IIS 7.5 德尔福XE2 我使用DelphiXe2制作了一个简单的WebService/ISAPI DLL。 此web服务有一个返回两个数字之和的函数,并制作了一个简单的客户端应用程序来测试此函数。 当我将它(连同客户机)编译为32位应用程序(在一个具有32位启用的应用程序池的虚拟目录中)时,一切都可以正常工作 当我将其编译为64位DLL(客户端也编译为64位应用程序)时,我会收到一个访问冲突错误“class ERemotableException,消息为“模块'MyWebService.DLL'中地址0000000002199F33处的访问冲突。读取地址0000000000000000”。” 我检查了所有应该执行的IIS7.5权限(32位ISAPI DLL工作正常),问题不断出现 以下是一些快速测试反馈: 如果我使用一个可旋转类子体在过程-->无pb中传递数据 但是,编写返回整数的简单函数会导致访问冲突。 我还尝试使用本机wndows数据类型,如Int64,但运气不佳 以前有人有过这样的问题吗?因为坦白说,我很绝望 代码如下: 这是webmodule接口Delphi XE2 64位ISAPI访问冲突,delphi,iis-7.5,delphi-xe2,isapi,Delphi,Iis 7.5,Delphi Xe2,Isapi,Windows Server 2008 R2 64位 IIS 7.5 德尔福XE2 我使用DelphiXe2制作了一个简单的WebService/ISAPI DLL。 此web服务有一个返回两个数字之和的函数,并制作了一个简单的客户端应用程序来测试此函数。 当我将它(连同客户机)编译为32位应用程序(在一个具有32位启用的应用程序池的虚拟目录中)时,一切都可以正常工作 当我将其编译为64位DLL(客户端也编译为64位应用程序)时,我会收到一个访问冲突错误“class ERemotableExce
{ Invokable interface IMyDebugModule }
unit MyDebugModuleIntf;
interface
uses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns;
type
{ Invokable interfaces must derive from IInvokable }
IMyDebugModule = interface(IInvokable)
['{02A5AD69-24E4-447B-8882-804DA687A0F2}']
{ Methods of Invokable interface must not use the default }
{ calling convention; stdcall is recommended }
//function MyFunc():double;stdcall;
function MyFunc():Int64;stdcall;
end;
implementation
initialization
{ Invokable interfaces must be registered }
InvRegistry.RegisterInterface(TypeInfo(IMyDebugModule));
end.
以及实施情况
{ Invokable implementation File for TMyDebugModule which implements IMyDebugModule }
unit MyDebugModuleImpl;
interface
uses Soap.InvokeRegistry, System.Types, Soap.XSBuiltIns, MyDebugModuleIntf;
type
{ TMyDebugModule }
TMyDebugModule = class(TInvokableClass, IMyDebugModule)
public
function MyFunc():Int64;stdcall;
end;
implementation
{ TMyDebugModule }
function TMyDebugModule.MyFunc: Int64;
begin
Result := 101;
end;
{ TMyDebugModule }
initialization
{ Invokable classes must be registered }
InvRegistry.RegisterInvokableClass(TMyDebugModule);
end.
下面是客户端应用程序WSDl pascal文件:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : C:\MyWorkingDir64\MyTests\WebServiceDebug\Client\IMyDebugModuleWSDL.xml
// Version : 1.0
// (19/04/2013 09:46:52 - - $Rev: 37707 $)
// ************************************************************************ //
unit IMyDebugModuleWSDL;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:long - "http://www.w3.org/2001/XMLSchema"[]
// ************************************************************************ //
// Namespace : urn:MyDebugModuleIntf-IMyDebugModule
// soapAction: urn:MyDebugModuleIntf-IMyDebugModule#MyFunc
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// use : encoded
// binding : IMyDebugModulebinding
// service : IMyDebugModuleservice
// port : IMyDebugModulePort
// URL : http://devserver2008/BahaaDebug/BahaaDebug.dll/soap/IMyDebugModule
// ************************************************************************ //
IMyDebugModule = interface(IInvokable)
['{64033E30-8D6E-F252-4E38-55502BF4E1A5}']
function MyFunc: Int64; stdcall;
end;
function GetIMyDebugModule(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IMyDebugModule;
implementation
uses SysUtils;
function GetIMyDebugModule(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IMyDebugModule;
const
defWSDL = 'C:\MyWorkingDir64\MyTests\WebServiceDebug\Client\IMyDebugModuleWSDL.xml';
defURL = 'http://devserver2008/BahaaDebug/BahaaDebug.dll/soap/IMyDebugModule';
defSvc = 'IMyDebugModuleservice';
defPrt = 'IMyDebugModulePort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as IMyDebugModule);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
{ IMyDebugModule }
InvRegistry.RegisterInterface(TypeInfo(IMyDebugModule), 'urn:MyDebugModuleIntf-IMyDebugModule', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IMyDebugModule), 'urn:MyDebugModuleIntf-IMyDebugModule#MyFunc');
end.
以及调用该函数的测试单元
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IMyDebugModuleWSDL, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
w:IMyDebugModule;
i:integer;
begin
w := GetIMyDebugModule(True,'',nil);
i := w.MyFunc;
caption := IntToStr(i);
end;
end.
你能显示代码吗。互操作界面的两侧。我编辑了问题以包含代码。谢谢。您是否安装了所有Xe2更新?坦率地说,没有。我知道我应该安装,但从我所在的位置很难通过网络下载大量数据(连接速度慢+配额限制)。我将更新并返回一个答案。谢谢你抽出时间。请原谅我在描述我的开发环境时忘记提到我仍在更新1。早期的XE2在64位编译器中有一些严重的COM错误。您确实需要更新来清除这些内容。看起来你正在使用COM!