Solved

DCOMError :Interface not supported

Posted on 2000-05-16
10
1,976 Views
Last Modified: 2008-03-17
I wrote a DCOM server app using D4 auotmation object wizard. I have registerd the app on a NT4 Server(sp 6) and used DCOmcnfg togive everyone the right to access and launch the app, and configured the identity of the app as the administrator account.

When I run a client app to access the server app from NT4 workst I get "Interface not supported" error from CreateRemoteComObject fcn in client app.

To debug I used CogetclassObject to get Classfactory from Server app,this worked fine. Then tried calling Createinstance fcn of classfactory but that returned error "Interface not registered". Checked HK_Classes _Root of registry on NT Server  and found entries for my app so it is registered.(Also it shows up in DComcnfg)

If i register server interface on workst then run client app it works fine.

Why doesn't the client app work if server interface not registered on workst?
0
Comment
Question by:mem100
  • 4
  • 3
  • 3
10 Comments
 
LVL 3

Expert Comment

by:KE
ID: 2815643
The client app. don't know about the interfaces that your server provides - as they are not registered anywhere. You have to register the type library on every client that will use the server remotely. The workstation should also be able to accesss the .tlb file, so you have to distribute this along with the client.

You can use tregsrv as part of the client installation - If you don't like tregsrv, the source is available on your Delphi CD.

Regards
0
 
LVL 1

Expert Comment

by:xsoft
ID: 2819228
You can copy the server.exe on the client machine and run it once.
After that it will be registered on the client machine and you can delete the server exe.
0
 

Author Comment

by:mem100
ID: 2819938
xsoft

I have done that and I know it works, but my understanding(correct me if I am wrong) of the process is that the COM libraries on the client machine will contact( using the machine name arg of the CreateremoteComobject fcn) the server machine and make a request to create the object and return an interface. As such the interface and  object only has to be reqistered on the server and not the client.

I have  another problem. My server makes calls to some LAN manager Net() fcns in the  Netapi32.dll so I can't run the server on my 95/98 clients to register the interface.
0
 
LVL 1

Expert Comment

by:xsoft
ID: 2821116
The Create and CreateRemote functions from the CoClass of your Com-Server are declared in the Typelibrary of the server, therefore the typelibrary has to be registered on the clientmachine also.

If you want to run the server on the client machine in order to get it registered, call it like this:
myserver.exe /REGSERVER
This will start your server, register it and immidiately terminate it after it was registered before calling any specific functions of your server.
This should work on your W95/98 clients too.

HTH,

Thomas
0
 

Author Comment

by:mem100
ID: 2823284
I understand about registering the typelib on the client. I tried to manually place the entries in the registry to register the typelib
did the foll.

in HKCR\servername.objectname\clsid key place
string value that is CLSID of object

in HKCR\CLSID\{CLSID of object}
 Added key typelib and then added string value  IID of typelib in the key

Added key ProgID and then added string value

servername.objectname in the key

but this didn't work. I even tried placing entries under
HKCR\appid\{Clsid}
HKCR\Appid\appname.exe

but that didn't work. ideally I would prefer to edit the registry that to run  the server on the client to register it.

I tried registering the server on the client like you said but because it is linked to the netapi32.dll through an external declaration it will try to load the dll even if no fcn are called.

I got the foll an errror on 95/98 machines:
"servername" is linked to missing export netapi32.dll"
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:KE
ID: 2830359
Distribute your client, with the myserver.tlb file, and use tregsrv to register the tlb file. I think the reason that your reg. entries are not working, is that you don't have any reference to the type library. As you don't install the server on the client machine, you won't have the type library available for your app.
The type library itself, is not stored in the registry - there's only a reference to either an .exe or .tlb file.

Regards
0
 

Author Comment

by:mem100
ID: 2833975
how do I register the *.tlb with tregsvr, doesn't tregsvr only work with *.exe and *.dll?

Can someone explain this:

I register the server on a client using the tregsvr
and ran the client, got no errors

Then I used regedt32 on the client and manually deleted all the registry entries in HKCR that tregsvr place for my server app. Ran the client afterwards and still got no errors. Rebooted the machine, ran the client again and still got no errors.Client works fine even though there are no registry entries for the server interface.

According to my understanding  only need to register the server interface on the client if using early(vtable) binding, but the Delphi automation object used create the server uses Dispatch interface which uses late binding so I shouldn't have to register the server interface on the client.
I included the server's typelib in the "uses" of my client project so the client knows the IID of the server interface and the CLSID of the server object.

What I describe about seems to confirm that the server interface doesn't have to be registered unless I missed some registery entries.

why is it the client won't work normally(server interface not registered) but will work if the interface is registered and then manually deleted.
0
 
LVL 1

Accepted Solution

by:
xsoft earned 100 total points
ID: 2835484
Just call tregsvr without parameters in a dos box. The you will see the different options with a short explanation. If you call tregsvr myserver.tlb it should normally succeed if the *.tlb is on this machine and you you call tregsvr from the same directory as where your TLB resides or sou supply the full path of your TLB to tregsvr.
If you leave the TLB on the client machine you would not need to have the server exe on that machine.

If you want to find out if the TLB-info is used from the server or the *.tlb look in the registry:
\HKEY_CLASSES_ROOT\TypeLib\{your TLB-ID}\1.0\0\win32

I suppose you forgot to delete this key and thats why your client did work.

HTH,

Thomas
0
 
LVL 3

Expert Comment

by:KE
ID: 2836198
Clients:
Late binding is ONLY used with script based client's, and VTable's is ONLY used with compiled clients.
So you are right about that you need to register the TLB on the client (assuming that your client is made with Delphi).

Regards
0
 

Author Comment

by:mem100
ID: 2837771
Exactly what I was looking for. Suspected that I was missing a registry entry but couldn't find what it was from all the documentation I had.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 284
TVirtualStringTree  search using TEdit 7 103
Delphi TcxGrid group footer summary 3 200
Delphi 2 45
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

943 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

7 Experts available now in Live!

Get 1:1 Help Now