Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: asp call dcom


Message #1 by "yhk" <hkyeong1@y...> on Tue, 20 Nov 2001 08:59:45
hi everybody:



Anybody  know how to call asp to dcom??



1)

can asp call the dcom?



my purpose is using asp call dcom (in one server) then  call another 

server .dll.



At the same time passing value or certain variable 

from ASP to dcom (server a) and then  to .dll (-server b)

then passing back the result back to asp (server a)



passing value or variable from 

asp--dcom <<server a>> 

to com/com+(server b)



passing result from 

com/com+(server b) back to 

asp (server a)



two way communication???



can it be done??

any idea?



2)

if i apply above method for <<asp--dcom--com--asp> plus the https (ssl)

need to fast response on result

it affect the time out issue at asp??





from 

hky







Message #2 by HKY <hkyeong1@y...> on Tue, 20 Nov 2001 06:10:57 -0800 (PST)
I am working on a network of NT/W2K workstations, and

we install

clients/servers in any machine, and they work

correctly even though they are

not in the same folder. In fact, the server can be in

a path which is not

existing in the client machine and viceversa.



One server could be

\\machine1\D:\Server\server1.exe



and a client

\\machine2\C:\MyFolder\Client22.exe



If server1.exe is installed properly in the registry

of machine1, Client2 is

able to connect to it through DCOM (running dcomcfng

on machine2) or by

passing "machine1" as the second par of CreateObject

(I use both methods all

the time with no problems)



Geeta, if you look for the error you are having "The

object exporter

specified was not found." in the MSDN library, you can

find many possible

reasons why your program does not work. Because they

are very specific, you

have to look to your special case.



Please let us know, because this is an interesting

case.



--- yhk <hkyeong1@y...> wrote:

> hi everybody:

> 

> Anybody  know how to call asp to dcom??

> 

> 1)

> can asp call the dcom?

> 

> my purpose is using asp call dcom (in one server)

> then  call another 

> server .dll.

> 

> At the same time passing value or certain variable 

> from ASP to dcom (server a) and then  to .dll

> (-server b)

> then passing back the result back to asp (server a)

> 

> passing value or variable from 

> asp--dcom <<server a>> 

> to com/com+(server b)

> 

> passing result from 

> com/com+(server b) back to 

> asp (server a)

> 

> two way communication???

> 

> can it be done??

> any idea?

> 

> 2)

> if i apply above method for <<asp--dcom--com--asp>

> plus the https (ssl)

> need to fast response on result

> it affect the time out issue at asp??

> 

> 

> from 

> hky

> 

> 

> 

> 

>  



> hkyeong1@y...


> $subst('Email.Unsub')

> 





=====

Regards,

HKY



__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #3 by "Lewis, James" <James.Lewis@i...> on Tue, 20 Nov 2001 09:53:16 -0700
We do this kind of thing here all the time. There are many ways to go about

it. One of the venerable hacks is to use DCOMCNFG.EXE (comes with windows)

to configure a local server COM control to execute on a remote machine

(under the location tab) when instantiated. This technique is limited to

out-of-process controls and doesn't work with DLL's. Remoting DLL's in

general is tricky as the DLL needs a remote proxy. Also you need to install

your COM control on both the web server and the remote sever. Though this is

strange, the web server needs access to the control's type library. You can

avoid this by exporting the type library and registering it with regtlib.exe

on the web server if you so desire, but it's not required. The control will

not actually run on the local server, its just there for the type library.



Or you could write a control similar to the one that I have written. This

control is called from ASP an expects a PROGID, remote machine name, user

name, and password. It instantiates the requested object on the specified

machine using the passed user security info. This prevents the remote

machine from receiving a NULL ACL which can lead to all kinds of mysterious

security problems. If you want to write a control like this I can guide you

through it - basically it's an ATL control that uses CoCreateInstanceEx and

actually DOES fill in the security struct  : o



J



-----Original Message-----

From: yhk [mailto:hkyeong1@y...]

Sent: Tuesday, November 20, 2001 2:00 AM

To: ASP components

Subject: [asp_components] asp call dcom





hi everybody:



Anybody  know how to call asp to dcom??



1)

can asp call the dcom?



my purpose is using asp call dcom (in one server) then  call another 

server .dll.



At the same time passing value or certain variable 

from ASP to dcom (server a) and then  to .dll (-server b)

then passing back the result back to asp (server a)



passing value or variable from 

asp--dcom <<server a>> 

to com/com+(server b)



passing result from 

com/com+(server b) back to 

asp (server a)



two way communication???



can it be done??

any idea?



2)

if i apply above method for <<asp--dcom--com--asp> plus the https (ssl)

need to fast response on result

it affect the time out issue at asp??





from 

hky









 




$subst('Email.Unsub')

Message #4 by HKY <hkyeong1@y...> on Tue, 20 Nov 2001 18:36:42 -0800 (PST)
hi Lewis, James :



thank for info..



1)

how the asp call dcom method?

how to control and using the DCOMCNFG.EXE in win2k?

and apply to vb/asp call .dll in another server?



the 

CreateObject(strClass, strServerName)

method

it is same as DCOMCNFG.EXE method?





2)i try the CreateObject(strClass, strServerName)

in vb

**

in vb first before move the code in asp..



i can passing value to another server2 .dll com



and run the the function i want



but problem is server 2 dll com is call the server2

com port 1 to passing some data to some device with

connect to server 2..





-->>

server 1(CreateObject(strClass, strServerName))



-->server2 .dll-->comport 1-->call device



it come out error of server 2 unable to connect to

device or time out error?



my question is whether when i passing value

of "comport no" in server 1 to server 2 using

CreateObject(strClass, strServerName) 

i need to specifiy the ip address follow by com port

no?



from

yeong...





--- "Lewis, James" <James.Lewis@i...> wrote:

> We do this kind of thing here all the time. There

> are many ways to go about

> it. One of the venerable hacks is to use

> DCOMCNFG.EXE (comes with windows)

> to configure a local server COM control to execute

> on a remote machine

> (under the location tab) when instantiated. This

> technique is limited to

> out-of-process controls and doesn't work with DLL's.

> Remoting DLL's in

> general is tricky as the DLL needs a remote proxy.

> Also you need to install

> your COM control on both the web server and the

> remote sever. Though this is

> strange, the web server needs access to the

> control's type library. You can

> avoid this by exporting the type library and

> registering it with regtlib.exe

> on the web server if you so desire, but it's not

> required. The control will

> not actually run on the local server, its just there

> for the type library.

> 

> Or you could write a control similar to the one that

> I have written. This

> control is called from ASP an expects a PROGID,

> remote machine name, user

> name, and password. It instantiates the requested

> object on the specified

> machine using the passed user security info. This

> prevents the remote

> machine from receiving a NULL ACL which can lead to

> all kinds of mysterious

> security problems. If you want to write a control

> like this I can guide you

> through it - basically it's an ATL control that uses

> CoCreateInstanceEx and

> actually DOES fill in the security struct  : o

> 

> J

> 

> -----Original Message-----

> From: yhk [mailto:hkyeong1@y...]

> Sent: Tuesday, November 20, 2001 2:00 AM

> To: ASP components

> Subject: [asp_components] asp call dcom

> 

> 

> hi everybody:

> 

> Anybody  know how to call asp to dcom??

> 

> 1)

> can asp call the dcom?

> 

> my purpose is using asp call dcom (in one server)

> then  call another 

> server .dll.

> 

> At the same time passing value or certain variable 

> from ASP to dcom (server a) and then  to .dll

> (-server b)

> then passing back the result back to asp (server a)

> 

> passing value or variable from 

> asp--dcom <<server a>> 

> to com/com+(server b)

> 

> passing result from 

> com/com+(server b) back to 

> asp (server a)

> 

> two way communication???

> 

> can it be done??

> any idea?

> 

> 2)

> if i apply above method for <<asp--dcom--com--asp>

> plus the https (ssl)

> need to fast response on result

> it affect the time out issue at asp??

> 

> 

> from 

> hky

> 

> 

> 

> 

>  



> james.lewis@i...


> $subst('Email.Unsub')

> 

>  



> hkyeong1@y...


> $subst('Email.Unsub')

> 





=====

Regards,

HKY



__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #5 by "Lewis, James" <James.Lewis@i...> on Wed, 21 Nov 2001 13:48:59 -0700
Hi HKY. 



1. How is the DCOM object instantated from ASP?



I wrote a control in ATL (C++) that allows me to instantiate any ProgID on a

remote machine from ASP. Sample JScript that uses my "ipni.creator" control

looks as follows. This function creates my creator "ipni.creator", and then

that control creates a remote object "ipni.repgen" on the remote machine

using the specified password, domain, and user:



function GetGenerator(szAppServer,szUser,szDomain,szPassword)

{

  var objIPNICreator = new ActiveXObject("ipni.creator");  <--- my control

  objRepListGenerator 

objIPNICreator.Create("IPNI.RepGen",szAppServer,szUser,szDomain,szPassword);

<--- remote instantation

  objIPNICreator = null;

  return objRepListGenerator;

}



function Foo()

{

	try

	{

		var objGenerator 

GetGenerator("\\\\joappserver","joeuser","jodomain","jopassword"); <---

create DCOM object

		var Session = objGenerator.CreateReplist(127,

"c:\\temp\~~4",...);  <--- DCOM CALL

	}

	catch(e)

	{

		// do whatever...

	}

}





It was not obvious to me how to do this type of DCOM work from ASP without

using a custom object. Though you can create remote objects in wscript 5.0

using the CreateObject method, this method doesn't seem to give any good

ways to control security, and I was not entirely clear on how to access it

from ASP...





2. DCOMCNFG



If you want to avoid any custom controls, you can use DCOMCNFG. DComCNFG is

a program that allows you to alter Local COM server registry settings, it's

not a COM control that you call from code. For local servers that are not

normally DCOM aware, as is typical for a VB application, you can go into

DCOMCNFG, find your appID, and change the location tab to point to a

different machine. The down side from this approach is that it is basically

a hack. When you instantiate the remote control from ASP the ACL on the

remote machine may be NULL. Unless you ALSO use DCOMCNFG on the remote

machine to open up default authentication to "NONE" and allow "everyone" to

instantiate the control, it likely will not work properly. But it can be

done... it's just not clear or always secure.



3. Remoting DLL's



I don't understand what you're trying to do with the com ports exactly, but

it sounds like you're trying to instantiate a control on a remote server to

read a com port. Not a problem - I have written similar code to talk to a

device driver on a remote machine using a COM control. Right away, I

discourage you from trying to remote a DLL though. COM wasn't well designed

to do that, if you're trying to remote a DLL onto another server that's hard

to do because DLL's are in process, so you have to provide a proxy for the

DLL. I've always made controls that I want to remote local servers so they

remote transparently. Also I strongly encourage you to understand the

security context that your controls are running in. com ports are devices

under windows and they have security settings just like all other win32

primitives. 





4. com ports



If you're trying to read the com port be sure that _WIN32_LEAN_AND_MEAN is

NOT defined. This will strip out some code you need to talk to the COM

ports. The com port has nothing to do with ip addresses inherent to remoting

a control - you do not need to pass that information as a parameter.

However, the IP address OR the NetBios name of the machine youre trying to

run your control on of course comes into play when you call createobject.







If I've understood all you;re trying to do, here's what some sample code

using my creator would look like IF your com port reader was converted to a

local server:



function ReadRemoteCOMPort()

{

	try

	{

		var objIPNICreator = new ActiveXObject("ipni.creator");

<--- my control

		objCOMReader 

objIPNICreator.Create("XXX.COMReader","\\\\someserver","someuser","somedomai

n","somepassword");

		objCOMReader.OpenPort("COM2");

		var szInData = objCOMReader.ReadPort();

		objCOMReader.ClosePort();

		objCOMReader = null;

		// Do whatever with the szInData 

		.

		.

		.

	}

	catch(e)

	{

		// do whatever...

	}

}



If you need help on writing an ATL control to do the remote instantation I

can show you how to write on....



J



-----Original Message-----

From: HKY [mailto:hkyeong1@y...]

Sent: Tuesday, November 20, 2001 7:37 PM

To: ASP components

Subject: [asp_components] RE: asp call dcom





hi Lewis, James :



thank for info..



1)

how the asp call dcom method?

how to control and using the DCOMCNFG.EXE in win2k?

and apply to vb/asp call .dll in another server?



the 

CreateObject(strClass, strServerName)

method

it is same as DCOMCNFG.EXE method?





2)i try the CreateObject(strClass, strServerName)

in vb

**

in vb first before move the code in asp..



i can passing value to another server2 .dll com



and run the the function i want



but problem is server 2 dll com is call the server2

com port 1 to passing some data to some device with

connect to server 2..





-->>

server 1(CreateObject(strClass, strServerName))



-->server2 .dll-->comport 1-->call device



it come out error of server 2 unable to connect to

device or time out error?



my question is whether when i passing value

of "comport no" in server 1 to server 2 using

CreateObject(strClass, strServerName) 

i need to specifiy the ip address follow by com port

no?



from

yeong...





--- "Lewis, James" <James.Lewis@i...> wrote:

> We do this kind of thing here all the time. There

> are many ways to go about

> it. One of the venerable hacks is to use

> DCOMCNFG.EXE (comes with windows)

> to configure a local server COM control to execute

> on a remote machine

> (under the location tab) when instantiated. This

> technique is limited to

> out-of-process controls and doesn't work with DLL's.

> Remoting DLL's in

> general is tricky as the DLL needs a remote proxy.

> Also you need to install

> your COM control on both the web server and the

> remote sever. Though this is

> strange, the web server needs access to the

> control's type library. You can

> avoid this by exporting the type library and

> registering it with regtlib.exe

> on the web server if you so desire, but it's not

> required. The control will

> not actually run on the local server, its just there

> for the type library.

> 

> Or you could write a control similar to the one that

> I have written. This

> control is called from ASP an expects a PROGID,

> remote machine name, user

> name, and password. It instantiates the requested

> object on the specified

> machine using the passed user security info. This

> prevents the remote

> machine from receiving a NULL ACL which can lead to

> all kinds of mysterious

> security problems. If you want to write a control

> like this I can guide you

> through it - basically it's an ATL control that uses

> CoCreateInstanceEx and

> actually DOES fill in the security struct  : o

> 

> J

> 

> -----Original Message-----

> From: yhk [mailto:hkyeong1@y...]

> Sent: Tuesday, November 20, 2001 2:00 AM

> To: ASP components

> Subject: [asp_components] asp call dcom

> 

> 

> hi everybody:

> 

> Anybody  know how to call asp to dcom??

> 

> 1)

> can asp call the dcom?

> 

> my purpose is using asp call dcom (in one server)

> then  call another 

> server .dll.

> 

> At the same time passing value or certain variable 

> from ASP to dcom (server a) and then  to .dll

> (-server b)

> then passing back the result back to asp (server a)

> 

> passing value or variable from 

> asp--dcom <<server a>> 

> to com/com+(server b)

> 

> passing result from 

> com/com+(server b) back to 

> asp (server a)

> 

> two way communication???

> 

> can it be done??

> any idea?

> 

> 2)

> if i apply above method for <<asp--dcom--com--asp>

> plus the https (ssl)

> need to fast response on result

> it affect the time out issue at asp??

> 

> 

> from 

> hky

> 

> 

> 

> 

>  



> james.lewis@i...


> $subst('Email.Unsub')

> 

>  



> hkyeong1@y...


> $subst('Email.Unsub')

> 





=====

Regards,

HKY



__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1



 




$subst('Email.Unsub')

Message #6 by HKY <hkyeong1@y...> on Wed, 21 Nov 2001 22:32:54 -0800 (PST)
hi:



1)



i has one big problem here..



if i has two server 

--server a and server b



server b has one c++ dll program call medvc2.dll

it will call the com port to another device then ...to

bank..



server a --got one vb program



i want server a- vb program--dll 

to passing value to server b--.dll



at the same time execute 

server b .dll to run it



then passing back the result to

server a --vb program...



any method to process it?



dcom?

the CreateObject(strClass, strServerName)?

soap?

or any other method?





2) 

--------

i try the CreateObject(strClass, strServerName)

in vb server a



**

in vb first before move the code in asp..



i can passing value to another server b .dll com



and run the the function i want





-->>

server a(CreateObject(strClass, strServerName))



-->server b .dll-->comport 1-->call device



it come out error of server b unable to connect to

device or time out error?



my question is whether when i passing value

of "comport no" in server a to server b using

CreateObject(strClass, strServerName) 

i need to specifiy the ip address follow by com port

no?



if i using the vb program to run locally in server b

-->it come out the result...

not problem at all



that mean using vb program in server b and execute

the server b--c++ dll program to process the comport

to run th process...



but if i using server a(CreateObject(strClass,

strServerName))



it come out--> time out error



if i usind dcom or soap to process it/...

it is better...?



i afraid it come out the time out error again..





some other small q 



a)how the asp call dcom method?



b)how to control and using the DCOMCNFG.EXE in win2k?

step by step on it

need to set in server a or server b in my case above 



And apply to vb/asp call .dll in another server?





the CreateObject(strClass, strServerName)

method  is same as DCOMCNFG.EXE method?



sorry i am new in dcom ....



i am also new in dcomcnfg..









from

yeong...

--- "Lewis, James" <James.Lewis@i...> wrote:

> Hi HKY. 

> 

> 1. How is the DCOM object instantated from ASP?

> 

> I wrote a control in ATL (C++) that allows me to

> instantiate any ProgID on a

> remote machine from ASP. Sample JScript that uses my

> "ipni.creator" control

> looks as follows. This function creates my creator

> "ipni.creator", and then

> that control creates a remote object "ipni.repgen"

> on the remote machine

> using the specified password, domain, and user:

> 

> function

> GetGenerator(szAppServer,szUser,szDomain,szPassword)

> {

>   var objIPNICreator = new

> ActiveXObject("ipni.creator");  <--- my control

>   objRepListGenerator 

>

objIPNICreator.Create("IPNI.RepGen",szAppServer,szUser,szDomain,szPassword);

> <--- remote instantation

>   objIPNICreator = null;

>   return objRepListGenerator;

> }

> 

> function Foo()

> {

> 	try

> 	{

> 		var objGenerator 

>

GetGenerator("\\\\joappserver","joeuser","jodomain","jopassword");

> <---

> create DCOM object

> 		var Session = objGenerator.CreateReplist(127,

> "c:\\temp\~~4",...);  <--- DCOM CALL

> 	}

> 	catch(e)

> 	{

> 		// do whatever...

> 	}

> }

> 

> 

> It was not obvious to me how to do this type of DCOM

> work from ASP without

> using a custom object. Though you can create remote

> objects in wscript 5.0

> using the CreateObject method, this method doesn't

> seem to give any good

> ways to control security, and I was not entirely

> clear on how to access it

> from ASP...

> 

> 

> 2. DCOMCNFG

> 

> If you want to avoid any custom controls, you can

> use DCOMCNFG. DComCNFG is

> a program that allows you to alter Local COM server

> registry settings, it's

> not a COM control that you call from code. For local

> servers that are not

> normally DCOM aware, as is typical for a VB

> application, you can go into

> DCOMCNFG, find your appID, and change the location

> tab to point to a

> different machine. The down side from this approach

> is that it is basically

> a hack. When you instantiate the remote control from

> ASP the ACL on the

> remote machine may be NULL. Unless you ALSO use

> DCOMCNFG on the remote

> machine to open up default authentication to "NONE"

> and allow "everyone" to

> instantiate the control, it likely will not work

> properly. But it can be

> done... it's just not clear or always secure.

> 

> 3. Remoting DLL's

> 

> I don't understand what you're trying to do with the

> com ports exactly, but

> it sounds like you're trying to instantiate a

> control on a remote server to

> read a com port. Not a problem - I have written

> similar code to talk to a

> device driver on a remote machine using a COM

> control. Right away, I

> discourage you from trying to remote a DLL though.

> COM wasn't well designed

> to do that, if you're trying to remote a DLL onto

> another server that's hard

> to do because DLL's are in process, so you have to

> provide a proxy for the

> DLL. I've always made controls that I want to remote

> local servers so they

> remote transparently. Also I strongly encourage you

> to understand the

> security context that your controls are running in.

> com ports are devices

> under windows and they have security settings just

> like all other win32

> primitives. 

> 

> 

> 4. com ports

> 

> If you're trying to read the com port be sure that

> _WIN32_LEAN_AND_MEAN is

> NOT defined. This will strip out some code you need

> to talk to the COM

> ports. The com port has nothing to do with ip

> addresses inherent to remoting

> a control - you do not need to pass that information

> as a parameter.

> However, the IP address OR the NetBios name of the

> machine youre trying to

> run your control on of course comes into play when

> you call createobject.

> 

> 

> 

> If I've understood all you;re trying to do, here's

> what some sample code

> using my creator would look like IF your com port

> reader was converted to a

> local server:

> 

> function ReadRemoteCOMPort()

> {

> 	try

> 	{

> 		var objIPNICreator = new

> ActiveXObject("ipni.creator");

> <--- my control

> 		objCOMReader 

>

objIPNICreator.Create("XXX.COMReader","\\\\someserver","someuser","somedomai

> n","somepassword");

> 		objCOMReader.OpenPort("COM2");

> 		var szInData = objCOMReader.ReadPort();

> 		objCOMReader.ClosePort();

> 		objCOMReader = null;

> 		// Do whatever with the szInData 

> 		.

> 		.

> 		.

> 	}

> 	catch(e)

> 	{

> 		// do whatever...

> 	}

> }

> 

> If you need help on writing an ATL control to do the

> remote instantation I

> can show you how to write on....

> 

> J

> 

> -----Original Message-----

> From: HKY [mailto:hkyeong1@y...]

> Sent: Tuesday, November 20, 2001 7:37 PM

> To: ASP components

> Subject: [asp_components] RE: asp call dcom

> 

> 

> hi Lewis, James :

> 

> thank for info..

> 

> 1)

> how the asp call dcom method?

> how to control and using the DCOMCNFG.EXE in win2k?

> and apply to vb/asp call .dll in another server?

> 

> the 

> CreateObject(strClass, strServerName)

> method

> it is same as DCOMCNFG.EXE method?

> 

> 

> 2)i try the CreateObject(strClass, strServerName)

> in vb

> **

> in vb first before move the code in asp..

> 

> i can passing value to another server2 .dll com

> 

> and run the the function i want

> 

> but problem is server 2 dll com is call the server2

> com port 1 to passing some data to some device with

> connect to server 2..

> 

> 

> -->>

> server 1(CreateObject(strClass, strServerName))

> 

> -->server2 .dll-->comport 1-->call device

> 

> 

=== message truncated ===





=====

Regards,

HKY



__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #7 by HKY <hkyeong1@y...> on Thu, 22 Nov 2001 05:10:28 -0800 (PST)
hi lewis:



another q...



tell me the different between activex dll

and activex exe



in my problem



can activex exe execute .dll file?

locally



can activex exe passing value to .dll file?

locally?



and get the value from .dll file?



can asp or vb standard exe or vb activex dll

(in server a) call the activex exe(in server b) ??



from yeong

--- "Lewis, James" <James.Lewis@i...> wrote:

> Hi HKY. 

> 

> 1. How is the DCOM object instantated from ASP?

> 

> I wrote a control in ATL (C++) that allows me to

> instantiate any ProgID on a

> remote machine from ASP. Sample JScript that uses my

> "ipni.creator" control

> looks as follows. This function creates my creator

> "ipni.creator", and then

> that control creates a remote object "ipni.repgen"

> on the remote machine

> using the specified password, domain, and user:

> 

> function

> GetGenerator(szAppServer,szUser,szDomain,szPassword)

> {

>   var objIPNICreator = new

> ActiveXObject("ipni.creator");  <--- my control

>   objRepListGenerator 

>

objIPNICreator.Create("IPNI.RepGen",szAppServer,szUser,szDomain,szPassword);

> <--- remote instantation

>   objIPNICreator = null;

>   return objRepListGenerator;

> }

> 

> function Foo()

> {

> 	try

> 	{

> 		var objGenerator 

>

GetGenerator("\\\\joappserver","joeuser","jodomain","jopassword");

> <---

> create DCOM object

> 		var Session = objGenerator.CreateReplist(127,

> "c:\\temp\~~4",...);  <--- DCOM CALL

> 	}

> 	catch(e)

> 	{

> 		// do whatever...

> 	}

> }

> 

> 

> It was not obvious to me how to do this type of DCOM

> work from ASP without

> using a custom object. Though you can create remote

> objects in wscript 5.0

> using the CreateObject method, this method doesn't

> seem to give any good

> ways to control security, and I was not entirely

> clear on how to access it

> from ASP...

> 

> 

> 2. DCOMCNFG

> 

> If you want to avoid any custom controls, you can

> use DCOMCNFG. DComCNFG is

> a program that allows you to alter Local COM server

> registry settings, it's

> not a COM control that you call from code. For local

> servers that are not

> normally DCOM aware, as is typical for a VB

> application, you can go into

> DCOMCNFG, find your appID, and change the location

> tab to point to a

> different machine. The down side from this approach

> is that it is basically

> a hack. When you instantiate the remote control from

> ASP the ACL on the

> remote machine may be NULL. Unless you ALSO use

> DCOMCNFG on the remote

> machine to open up default authentication to "NONE"

> and allow "everyone" to

> instantiate the control, it likely will not work

> properly. But it can be

> done... it's just not clear or always secure.

> 

> 3. Remoting DLL's

> 

> I don't understand what you're trying to do with the

> com ports exactly, but

> it sounds like you're trying to instantiate a

> control on a remote server to

> read a com port. Not a problem - I have written

> similar code to talk to a

> device driver on a remote machine using a COM

> control. Right away, I

> discourage you from trying to remote a DLL though.

> COM wasn't well designed

> to do that, if you're trying to remote a DLL onto

> another server that's hard

> to do because DLL's are in process, so you have to

> provide a proxy for the

> DLL. I've always made controls that I want to remote

> local servers so they

> remote transparently. Also I strongly encourage you

> to understand the

> security context that your controls are running in.

> com ports are devices

> under windows and they have security settings just

> like all other win32

> primitives. 

> 

> 

> 4. com ports

> 

> If you're trying to read the com port be sure that

> _WIN32_LEAN_AND_MEAN is

> NOT defined. This will strip out some code you need

> to talk to the COM

> ports. The com port has nothing to do with ip

> addresses inherent to remoting

> a control - you do not need to pass that information

> as a parameter.

> However, the IP address OR the NetBios name of the

> machine youre trying to

> run your control on of course comes into play when

> you call createobject.

> 

> 

> 

> If I've understood all you;re trying to do, here's

> what some sample code

> using my creator would look like IF your com port

> reader was converted to a

> local server:

> 

> function ReadRemoteCOMPort()

> {

> 	try

> 	{

> 		var objIPNICreator = new

> ActiveXObject("ipni.creator");

> <--- my control

> 		objCOMReader 

>

objIPNICreator.Create("XXX.COMReader","\\\\someserver","someuser","somedomai

> n","somepassword");

> 		objCOMReader.OpenPort("COM2");

> 		var szInData = objCOMReader.ReadPort();

> 		objCOMReader.ClosePort();

> 		objCOMReader = null;

> 		// Do whatever with the szInData 

> 		.

> 		.

> 		.

> 	}

> 	catch(e)

> 	{

> 		// do whatever...

> 	}

> }

> 

> If you need help on writing an ATL control to do the

> remote instantation I

> can show you how to write on....

> 

> J

> 

> -----Original Message-----

> From: HKY [mailto:hkyeong1@y...]

> Sent: Tuesday, November 20, 2001 7:37 PM

> To: ASP components

> Subject: [asp_components] RE: asp call dcom

> 

> 

> hi Lewis, James :

> 

> thank for info..

> 

> 1)

> how the asp call dcom method?

> how to control and using the DCOMCNFG.EXE in win2k?

> and apply to vb/asp call .dll in another server?

> 

> the 

> CreateObject(strClass, strServerName)

> method

> it is same as DCOMCNFG.EXE method?

> 

> 

> 2)i try the CreateObject(strClass, strServerName)

> in vb

> **

> in vb first before move the code in asp..

> 

> i can passing value to another server2 .dll com

> 

> and run the the function i want

> 

> but problem is server 2 dll com is call the server2

> com port 1 to passing some data to some device with

> connect to server 2..

> 

> 

> -->>

> server 1(CreateObject(strClass, strServerName))

> 

> -->server2 .dll-->comport 1-->call device

> 

> 

=== message truncated ===





=====

Regards,

HKY



__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1


  Return to Index