Solved

Delphi com object cant be seen in IIS

Posted on 2007-12-05
16
276 Views
Last Modified: 2013-11-18
hi

I have written a delphi com object for a 3rd party (they use VB & .Net)
but say they cant see the methods or run it under IIS, can if run locally

I am probably doing something wrong and need advice. help.

Is there anything obvious I need to change.
interface
 

uses

  Windows, ActiveX, Classes, ComObj,

  Strand_LREG_TLB, StdVcl, Dialogs,

  Variants, LREG_Main, SysUtils;
 

type

  TStrand_LREG_FClass = class(TTypedComObject, IStrand_LREG_FClass)

  protected

    function ELREG_RegSearch(const strxml: WideString;

      var strResult: WideString): HResult; stdcall;

    {Declare IStrand_LREG_FClass methods here}

  end;
 

implementation
 

uses ComServ;
 

function TStrand_LREG_FClass.ELREG_RegSearch(const strxml: WideString;

  var strResult: WideString): HResult;

var

  TheForm: LREG_Main.TForm1;

begin

  result := 1;

   try

    TheForm := LREG_Main.TForm1.Create(nil);

    strResult := TheForm.GetElregUPRN(strxml);

    result := 0;

  except

    On E: Exception do

      ShowMessage(E.Message);

  end;

 end;
 

initialization

  TTypedComObjectFactory.Create(ComServer, TStrand_LREG_FClass, Class_Strand_LREG_FClass,

    ciMultiInstance, tmApartment);

Open in new window

0
Comment
Question by:junebrown
  • 7
  • 6
  • 3
16 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 20410050
what you mean by saying "they cant see the methods or run it under IIS"?

does this TheForm := LREG_Main.TForm1.Create(nil); mean that you create form??

creating any GUI under IIS is not a good idea since IIS is service. in order to use GUI with services you need:
1. set desktop interactive to true for service
2. user account used to start service must have appropriate permissions

ziolko.

0
 

Author Comment

by:junebrown
ID: 20410173
the 3rd party have come back with

not sure what is meant be desktop interactive, but the access permission are that of administrator so the hierarchically that should be sufficient
0
 
LVL 21

Expert Comment

by:ziolko
ID: 20410202
>>not sure what is meant be desktop interactive

go to computer management list all services and display properties there's checkbox "Desktop Interactive" which must be checked if service is about to use some GUI

>>but the access permission are that of administrator
IIS typicaly runs in IWAM_XXX or IUSR_XXX accounts does it mean you assigned administrative permissions to those accounts? or changed startup user to user with admin privs?

anyway displaying GUI in service esp. IIS is this really needed?

ziolko.
0
 

Author Comment

by:junebrown
ID: 20410225
The GUI isnit used, we were trying to get around something else
all we want to do is call up the datamodule and get an address back.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 20410268
gui is used in your sample but nevermind.

make sure COM library is registered and IIS is using apropriate CLSID to load lib and create objects

ziolko.
0
 

Author Comment

by:junebrown
ID: 20410584
I am told by this third party that my application isnt a com object as he see it, although it was created as I
Any clues.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 20410669
how did you created your object?

make sure he called regsvr32 to register DLL you created

ziolko.
0
 

Author Comment

by:junebrown
ID: 20410788
It was created via

project : file->other->active x tab then new active x library.

then add a com object via file->other (active x tab) com obj.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 21

Expert Comment

by:ziolko
ID: 20410813
that's strange everything seems ok.

i guess only way to find out what's wrong is to ask your 3rd party devs how they're trying to use your library

ziolko.
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 20411137
Did they register the COM object?  I am amazed how often that is overlooked...

RegSvr32 /i MyComObj.dll
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 20411141
(It should work without the /i)
0
 
LVL 21

Expert Comment

by:ziolko
ID: 20411160
i've already suggested it twice but no response..

ziolko.
0
 

Author Comment

by:junebrown
ID: 20411728
Sorry but i have been out. Yes they say it has been registered

the other company have come back with (as far as I can see the application I have developed is a com object, so hitting my head against a brick wall)

Nothing is ok; in the sense that its not doing what needs to be - that is being used in a web service on an IIS box.
That and the fact that the previous version of the srand_lreg.dll isn't a COM component.
We don't have a third party developer, we have an in-house  web application that calls the proposed web service with an xml Uprn number, expecting an xml output from strand. I'm assuming that the srand_lreg.dll is supposed to be a COM file, none of the previous version of this dll have been, the only time I have seen a COM file during this exercise is when you have supplied the LREG_COM which has no methods that accept anything like the parameters of the srand_lreg.dll.


0
 

Author Comment

by:junebrown
ID: 20412834
I am struggling with this as my colleague who wrote this has resigned, so can anybody assist
I am quite happy to send code through, if this helps resolve this quickly. Ignorance isnt bliss in this case (for me)
0
 
LVL 21

Accepted Solution

by:
developmentguru earned 500 total points
ID: 20413011
--I am told by this third party that my application isnt a com object as he see it, although it was
--created as I Any clues.

  If your 3rd party is using VB then they will try to import the type library of the COM object.  If he does not see it in his list of available COM objects then they have not registered it.

  I am using a COM object on IIS to control the printing of Rave reports to a PDF through a web request.  I know from that experience that what you are trying to do is possible.  As I recall I had one issue with getting my COM object to work and that was giving IIS the rights to access the area of the registry that looks up the GUID for the object itself.  Here is the important clip line from CodeGear support.

--Grant read access to HKEY_CLASSES_ROOT\CLSID to the NETWORK SERVICE user--

  This got my web page to be able to instantiate a com object.  To do that go to the key in the RegEdit program and use the Edit | Permissions menu.  Obviously this must be done on the IIS server and permissions must be granted for the correct user account.

Let me know if this works for your 3rd party.
0
 

Author Closing Comment

by:junebrown
ID: 31412800
Your messages forced the 3rd party to go back and check, what they were using was Windows 2000 & IIS 5, they have upgraded to Window 2003 & IIS6 and it all started to work. it is good to have independant experts to fall back on, as everyone recognises EE.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now