Solved

about my simple MTS example "interface not supported"

Posted on 2001-07-13
42
272 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:kangxy
  • 23
  • 19
42 Comments
 
LVL 2

Expert Comment

by:SChertkov
ID: 6285754
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
 

Author Comment

by:kangxy
ID: 6285784
ok,I try to use your code, but same probleam.
It's still report interface not support
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6285870
What interface not support,  IDispatch ?
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6285882
Be sure that you use CreateRemoteComObject from ComObj
instead of Coatest.CreateRemote('kxy')
0
 

Author Comment

by:kangxy
ID: 6285892
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6285940
Try following

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

Are CLASS_aTest created successfully ?
0
 

Author Comment

by:kangxy
ID: 6285971
In the same computer, It's work well.
but if i copy Client to another computer, it's Report this.
0
 

Author Comment

by:kangxy
ID: 6285976
Maybe you can write a sample to test it:)
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6286039
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
 

Author Comment

by:kangxy
ID: 6288109
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6289738
I am not understand, are CLASS_aTest created successfully
in remote configuration ?
0
 

Author Comment

by:kangxy
ID: 6292031
How to know the CLASS_aTest created successfully?
I set breakpoint in Server's Code. but not use.
0
 

Author Comment

by:kangxy
ID: 6292032
In the sample machine,I can debug it.
0
 

Author Comment

by:kangxy
ID: 6292196
In the sample machine,I can debug it.
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6292279
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
 

Author Comment

by:kangxy
ID: 6292339
It's {2} g:=unk as IDiapatch.
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6292382
Show me you server code
0
 

Author Comment

by:kangxy
ID: 6292397
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6292579
Are Terminal Services used on you server system ?
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6292589
That identify indicated in package properties ?
0
 

Author Comment

by:kangxy
ID: 6292620
Terminal Services not used,It's disabled.
The second problem is YES. but if I set it to NONE,the problem is same.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:kangxy
ID: 6292670
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
 
LVL 2

Accepted Solution

by:
SChertkov earned 300 total points
ID: 6293419
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6293589
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
 

Author Comment

by:kangxy
ID: 6294017
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
 

Author Comment

by:kangxy
ID: 6294027
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294060
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294069
Read carefully
"COM Internet Services" by Marc Levy in MSDN
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294078
COM Internet Service acts via HTTP on 80 port.
0
 

Author Comment

by:kangxy
ID: 6294126
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
 

Author Comment

by:kangxy
ID: 6294211
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294239
No.
In client you must installed DCOM (it installed always
with IE 5 ) and register server typelib if you plan
use dual interface.
0
 

Author Comment

by:kangxy
ID: 6294263
Your mean that I did not copy anythink about MTS?
just copy my client program then OK?
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294314
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
 

Author Comment

by:kangxy
ID: 6294334
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
 

Author Comment

by:kangxy
ID: 6294387
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
 

Author Comment

by:kangxy
ID: 6294398
our endusers know very little about computer.
0
 

Author Comment

by:kangxy
ID: 6294428
which is better between using my own TCP/IP server/client and using CIS?
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 6294494
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
 

Author Comment

by:kangxy
ID: 6296602
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
 
LVL 2

Expert Comment

by:SChertkov
ID: 6301303
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
 

Author Comment

by:kangxy
ID: 6301531
ok
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

15 Experts available now in Live!

Get 1:1 Help Now