iis 7.5 - Delphi XE2 64 bit ISAPI Access Violation -


windows server 2008 r2 64 bit iis 7.5 delphi xe2

i made simple webservice/isapi dll using delphi xe2. web service has function returns sum of 2 numbers , made simple client application test function. when compile (along client) 32 bit application (in virtual directory 32-bit enabled app pool), works fine

when compile 64 bit dll (the client compiled 64-bit aplication) alws access violation error "class eremotableexception message 'access violation @ address 0000000002199f33 in module 'mywebservice.dll'. read of address 0000000000000000'."

i checked iis7.5 permissions should (the 32 bit isapi dll works fine) , problem kept appearing.

here quick test feed back:

if used tremotable class descendant pass data in procedure --> no pb

however, writing simple function returns integer causes access violation. tried use native wndows data types such int64 without luck.

did 1 had such problem before? because frankly desperate.

here code:

this webmodule interface

{ invokable interface imydebugmodule }  unit mydebugmoduleintf;  interface  uses soap.invokeregistry, system.types, soap.xsbuiltins;  type    { invokable interfaces must derive iinvokable }   imydebugmodule = interface(iinvokable)   ['{02a5ad69-24e4-447b-8882-804da687a0f2}']      { methods of invokable interface must not use default }     { calling convention; stdcall recommended }     //function myfunc():double;stdcall;     function myfunc():int64;stdcall;   end;  implementation  initialization   { invokable interfaces must registered }   invregistry.registerinterface(typeinfo(imydebugmodule));  end. 

and implementaion

{ invokable implementation file tmydebugmodule 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 registered }    invregistry.registerinvokableclass(tmydebugmodule); end. 

and here client app wsdl pascal file:

// ************************************************************************ // // types declared in file generated data read // 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    // ************************************************************************ //   // following types, referred in wsdl document not being represented   // in file. either aliases[@] of other types represented or referred   // never[!] declared in document. types latter category   // typically map predefined/known xml or embarcadero types; however,    // indicate incorrect wsdl documents failed declare or import 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 = '')   begin     if usewsdl       addr := defwsdl     else       addr := defurl;   end;   if httprio = nil     rio := thttprio.create(nil)   else     rio := httprio;   try     result := (rio imydebugmodule);     if usewsdl     begin       rio.wsdllocation := addr;       rio.service := defsvc;       rio.port := defprt;     end else       rio.url := addr;       if (result = nil) , (httprio = nil)       rio.free;   end; end;   initialization   { imydebugmodule }   invregistry.registerinterface(typeinfo(imydebugmodule), 'urn:mydebugmoduleintf-imydebugmodule', '');   invregistry.registerdefaultsoapaction(typeinfo(imydebugmodule), 'urn:mydebugmoduleintf-imydebugmodule#myfunc');  end. 

and test unit called function

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);   := w.myfunc;   caption := inttostr(i); end;  end. 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -