about my simple MTS example "interface not supported"

I want to try to use MTS so I build a sample
1) server
new a Axtice Lib Project.
new a MTS Object, named "atest"
Add a Method named "GetServerTime";
Install MTS Object
2) client
inlcude server's *_tlb.pas
write this code

procedure TForm2.Button1Click(Sender: TObject);
var
  aObj : Iatest;
begin
  aObj := Coatest.CreateRemote('kxy');
  ShowMessage(FormatDateTime('yyyy-mm-dd',aObj.getServerTime));
end;

so, in the same computer, It work will. now I try to run my client in other computer, I use MTS Explore to Import a aaa.msi, run aaa.msi in a client computer. copy my client test application to client computer,run it , but It report "interface not supported".

My server and client also Win2000 Server, how can I do?
thx
kangxyAsked:
Who is Participating?
 
SChertkovConnect With a Mentor Commented:
Yes, but win2k have COM internet services and
if it configured properly this allows you call
MTS objects directly through inet from DCOM clients.
(see "COM Internet Services" by Marc Levy in MSDN)


In my configuration same problem
"interface not supported" appear when dllhost.exe
can not access to registry keys of MTS objects
(probably typelib) from established identify.

Try following (on server):

1. Delete package.
   Registrer you objects with regsvr32.
   Recreate package manual (not import).
2. Set package identify to administrator account
   or you current user account (that logon locally).
3. Check OLE registry access permissions for you objects
   with helping regedt32.
   Registry keys for you objects must have permission
   to package identify user account.

After this steps
Coatest.CreateRemote('kxy') (!!)
become work in my configuration.


0
 
SChertkovCommented:
Try use following

uses ...., ComObj;
....

var
  g: OleVariant;

g := CreateRemoteComObject('kxy', CLASS_aTest) as IDispatch;

In brief use IDispatch and variant instead of
dual interfaces from you *_TLB.pas
0
 
kangxyAuthor Commented:
ok,I try to use your code, but same probleam.
It's still report interface not support
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SChertkovCommented:
What interface not support,  IDispatch ?
0
 
SChertkovCommented:
Be sure that you use CreateRemoteComObject from ComObj
instead of Coatest.CreateRemote('kxy')
0
 
kangxyAuthor Commented:
this my new code
var
  g : OleVariant;
begin
  g := CreateRemoteComObject('kxy', CLASS_aTest) as IDispatch;
  ShowMessage(FormatDateTime('yyyy-mm-dd',g.getServerTime));

It's report a message just say "interface not supported"
no more information.
0
 
SChertkovCommented:
Try following

var
  unk: IUnknown;
begin
  unk := CreateRemoteComObject('kxy', CLASS_aTest);

Are CLASS_aTest created successfully ?
0
 
kangxyAuthor Commented:
In the same computer, It's work well.
but if i copy Client to another computer, it's Report this.
0
 
kangxyAuthor Commented:
Maybe you can write a sample to test it:)
0
 
SChertkovCommented:
I am write example and test it.
In my configuration it works fine
( Win2k server + Win2k client ).

Really in remote configuration Coatest.CreateRemote('kxy')
did not work because it use cast to IaTest, but with
variants and CreateRemoteComObject it work ok.
Once again find out are CLASS_aTest created successfully
in remote configuration ? It's possible that you not
configure COM+ access and launch permission.
Interface IDispatch supported COM in any cases.
0
 
kangxyAuthor Commented:
I think it remote configuration's problem.
Would you tell me how to set it?
I want to users use my MTS object from internet,and how to set it?
thx a lot.
0
 
SChertkovCommented:
I am not understand, are CLASS_aTest created successfully
in remote configuration ?
0
 
kangxyAuthor Commented:
How to know the CLASS_aTest created successfully?
I set breakpoint in Server's Code. but not use.
0
 
kangxyAuthor Commented:
In the sample machine,I can debug it.
0
 
kangxyAuthor Commented:
In the sample machine,I can debug it.
0
 
SChertkovCommented:
Try following steps:

var
 unk: IUnknown;
  g: OleVariant;
begin
{1} unk := CreateRemoteComObject('kxy', CLASS_aTest);

{2} g := unk as IDispatch;

{3} ShowMessage(FormatDateTime('yyyy-mm-dd', g.getServerTime));

Let me know what step raised exception.

0
 
kangxyAuthor Commented:
It's {2} g:=unk as IDiapatch.
0
 
SChertkovCommented:
Show me you server code
0
 
kangxyAuthor Commented:
I do server just like this
1)File|New-->ActiveX Library
2)File|New--->MTS Object
3)View| Type Libray.. Add a function named"GetServerName";
function Tatest.GetServerTime: TDateTime;
begin
  Result := Now;
end;
0
 
SChertkovCommented:
Are Terminal Services used on you server system ?
0
 
SChertkovCommented:
That identify indicated in package properties ?
0
 
kangxyAuthor Commented:
Terminal Services not used,It's disabled.
The second problem is YES. but if I set it to NONE,the problem is same.
0
 
kangxyAuthor Commented:
I change my program's stucture to this->
Build a server USE TCP,this Server is Client of MTS Obj.and the TCP Server and MTS server in same computer.
client is a TCP client,use TCP/IP protoal to send command
and revice data from TCP server. TCP server get date from MTS server, and I think is OK.Do you think so?
0
 
SChertkovCommented:
Note: Remember that if you want use dual
interfaces on client you must register server
typelib on client else use IDispatch and variant
instead of dual interfaces
0
 
kangxyAuthor Commented:
thx,yes It's work.
but I think use TCP server and client maybe better.because
I need not copy MTS's to client.

:)
0
 
kangxyAuthor Commented:
and use TCP/Ip i can through Proxy.
if I use CreateRemote..... then how can I through Proxy if
the client behind a firewall?
0
 
SChertkovCommented:
You not need copy MTS to client !!!
In client it is enough DCOM, i.e. IE 5 or later
and you application
(for example you can deploy this application as
ActiveX inserted in html page).
You simple CreateRemoteObject on client and
connect to you server.
MTS need only on server !
0
 
SChertkovCommented:
Read carefully
"COM Internet Services" by Marc Levy in MSDN
0
 
SChertkovCommented:
COM Internet Service acts via HTTP on 80 port.
0
 
kangxyAuthor Commented:
hehe :)
yes, I known I did not copy MTS to client,but i think it is necesary to copy MTS's client installing program to client.
0
 
kangxyAuthor Commented:
hehe :)
yes, I known I did not copy MTS to client,but i think it is necesary to copy MTS's client installing program to client.
0
 
SChertkovCommented:
No.
In client you must installed DCOM (it installed always
with IE 5 ) and register server typelib if you plan
use dual interface.
0
 
kangxyAuthor Commented:
Your mean that I did not copy anythink about MTS?
just copy my client program then OK?
0
 
SChertkovCommented:
Yes !

But you must enable and configure
COM Internet Services on you server,
and if you plan use dual interfaces
you must register server tlb in you client.
(you can use RegisterTypeLib every time at
start client program)
0
 
kangxyAuthor Commented:
I read the Marc Levy's COM Internet Services,and need to configured client, but we enduser not know how to configured I think. so my Program's install may become complex.
0
 
kangxyAuthor Commented:
CIS requires that DCOM95 1.2 or a later version be installed on your Windows 95 machine. On Windows 98, you must have DCOM98 1.3 or later installed. DCOM98 1.3 will ship with Windows 98 OSR1 and can also be downloaded from the Microsoft COM Home Page.
Windows NT 4.0 SP4 and Windows 2000 need set DCOMCFG
set Http Proxy etc. we need insert all this in my installer. I think it's a hardwork:(
0
 
kangxyAuthor Commented:
our endusers know very little about computer.
0
 
kangxyAuthor Commented:
which is better between using my own TCP/IP server/client and using CIS?
0
 
SChertkovCommented:
If application simple and client numbers small you
can try own TCP/IP client/server.

For many clients and complicated applications
CIS better, because own TCP/IP
client/server required own RMI protocols,
connection control and many other things.

But you can try other technologies: CORBA,
Delphi 6 DataSnap, SOAP...

I think that real alternative is CORBA,
but ORB must be installed on client and so on... :)

By the way DataSnap look pretty, but i not try use it.
0
 
kangxyAuthor Commented:
My application is small,but client number is big.
my application just do this: check user login information,then send a list of URL,user use this list to download something,when done,send a message to my server,update URL list.
my TCP server use Indy's idTCPServer. your mean is this server cannot support many clients?
0
 
SChertkovCommented:
I think that in you case you can try use IIS on server side with ISAPI (WebSnap) or ASP + MTS. This more flexible
solution.

I am not work with Indy, but FastNet in Delphi 5
work bad.

0
 
kangxyAuthor Commented:
ok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.