远程调用COM模拟其他用户 [英] Remote call to COM impersonating another user

查看:88
本文介绍了远程调用COM模拟其他用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用C#从远程计算机调用COM对象。我还需要

传递一个不同的用户ID和密码来进行通话。有没有人这样做过?

我使用Java来使用JIntegra来做这件事,但是我使用的应用程序是
需要.NET。


有什么建议吗?

I need to call a COM object from a remote machine using C#. I also need to
pass on a different userID and password to the call. Has anyone done this?
I''ve used Java to do this using JIntegra, but the application I''m using
requires .NET.

Any advice?

推荐答案

嗯,你很可能不得不通过DCOM / COM +来打电话。 />
假设你在另一台机器上设置正确,并且你想要调用的COM对象有一个

接口定义,你可以调用

GetTypeFromProgID(或GetTypeFromCLSID),使用重载将需要

a远程机器名。然后,您将通过调用Activator类上的CreateInstance创建该类型的实例

,并转换为您的

接口类型。


请注意,进行远程调用的语义不仅仅是

进行常规COM调用(激活上下文,实例化等)。


您是否已经为远程呼叫设置了对象?


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


JCav < jc ******** @ cinci.rr.com在留言中写道

news:47 ******************** ** @ roadrunner.com ...
Well, you are more than likely going to have to call through DCOM/COM+.
Assuming you have it set up correctly on the other machine, and you have an
interface definition for the COM object you want to call, you can call the
GetTypeFromProgID (or GetTypeFromCLSID), using the overload which will take
a remote machine name. You would then create an instance of that type
through a call to CreateInstance on the Activator class, and cast to your
interface type.

Mind you, the semantics of making a remote call are different than just
making a regular COM call (activation contexts, instancing, and the like).

Do you already have the object set up for remote calls?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JCav" <jc********@cinci.rr.comwrote in message
news:47**********************@roadrunner.com...

>我需要使用C#从远程机器调用COM对象。我还需要为调用传递不同的用户ID和密码。有没有人这样做过?
我使用Java来使用JIntegra,但是我正在使用的应用程序需要.NET。


Any建议?
>I need to call a COM object from a remote machine using C#. I also need to
pass on a different userID and password to the call. Has anyone done this?
I''ve used Java to do this using JIntegra, but the application I''m using
requires .NET.

Any advice?



它是为远程呼叫设置的 - 我可以使用
$ b远程拨打这些电话$ b JIntegra。我想我需要的是复制JIntegra的功能。我得到了

身份验证错误,这让我相信我需要机制

设置带有凭据的呼叫 - 在这种情况下是userID,密码。



Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com写在

消息新闻:%2 *************** @ TK2MSFTNGP03.phx.gbl ...
It''s set up for remote calls - I am able to make these calls remotely using
JIntegra. I guess what I need is to duplicate what JIntegra does. I get
authentication errors which leads me to believe that I need the mechanism
that sets up the call with credentials - in this case userID, password.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2***************@TK2MSFTNGP03.phx.gbl...

嗯,你很可能不得不通过DCOM / COM +打电话。

假设你已经正确设置了它其他机器,你有一个你要调用的COM对象的接口定义,你可以调用

GetTypeFromProgID(或GetTypeFromCLSID),使用重载

采用远程机器名称。然后,您将通过在Activator类上调用CreateInstance来创建该

类型的实例,并将其转换为

您的界面类型。


请注意,进行远程调用的语义不仅仅是

进行常规COM调用(激活上下文,实例化等)。


您是否已经为远程呼叫设置了对象?


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


JCav < jc ******** @ cinci.rr.com在留言中写道

news:47 ******************** ** @ roadrunner.com ...
Well, you are more than likely going to have to call through DCOM/COM+.
Assuming you have it set up correctly on the other machine, and you have
an interface definition for the COM object you want to call, you can call
the GetTypeFromProgID (or GetTypeFromCLSID), using the overload which will
take a remote machine name. You would then create an instance of that
type through a call to CreateInstance on the Activator class, and cast to
your interface type.

Mind you, the semantics of making a remote call are different than just
making a regular COM call (activation contexts, instancing, and the like).

Do you already have the object set up for remote calls?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JCav" <jc********@cinci.rr.comwrote in message
news:47**********************@roadrunner.com...

>>我需要使用C#从远程计算机调用COM对象。我还需要为调用传递不同的用户ID和密码。有没有人这样做过?
我使用Java来使用JIntegra来做这件事,但是我正在使用的应用程序需要.NET。

有什么建议吗? />
>>I need to call a COM object from a remote machine using C#. I also need to
pass on a different userID and password to the call. Has anyone done this?
I''ve used Java to do this using JIntegra, but the application I''m using
requires .NET.

Any advice?




好吧,你总是可以在客户端线程上冒充那个调用者,并且

然后通过P / Invoke层调用CoImpersonateClient API函数

(确保调用CoRevertToSelf)。


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" JCav" < jc ******** @ cinci.rr.com在留言中写道

news:47 ******************** ** @ roadrunner.com ...
Well, you can always impersonate that caller on the client thread, and
then call the CoImpersonateClient API function through the P/Invoke layer
(make sure to call CoRevertToSelf).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JCav" <jc********@cinci.rr.comwrote in message
news:47**********************@roadrunner.com...

它是为远程呼叫设置的 - 我可以远程拨打这些电话

使用JIntegra。我想我需要的是复制JIntegra的功能。我获得了身份验证错误,这让我相信我需要使用凭证设置呼叫的

机制 - 在这种情况下是userID,

密码。


Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com写了
消息新闻中的
:%2 *************** @ TK2MSFTNGP03.phx.gbl ...
It''s set up for remote calls - I am able to make these calls remotely
using JIntegra. I guess what I need is to duplicate what JIntegra does. I
get authentication errors which leads me to believe that I need the
mechanism that sets up the call with credentials - in this case userID,
password.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2***************@TK2MSFTNGP03.phx.gbl...

>好吧,你很可能不得不打电话通过
DCOM / COM +。假设你在另一台机器上正确设置了它,并且你有一个你要调用的COM对象的接口定义,你可以使用
重载将采用远程机器名称。然后,您将通过在Activator
类上调用CreateInstance来创建该类型的实例,并转换为您的接口类型。

请注意,制作一个语义远程调用不仅仅是定期进行COM调用(激活上下文,实例化等等)。

你是否已经为远程调用设置了对象?

-
- Nicholas Paldino [.NET / C#MVP]
- mv * @ spam.guard.caspershouse.com

JCav < jc ******** @ cinci.rr.com在留言中写道
新闻:47 ********************** @ roadrunner .com ...
> Well, you are more than likely going to have to call through
DCOM/COM+. Assuming you have it set up correctly on the other machine,
and you have an interface definition for the COM object you want to call,
you can call the GetTypeFromProgID (or GetTypeFromCLSID), using the
overload which will take a remote machine name. You would then create an
instance of that type through a call to CreateInstance on the Activator
class, and cast to your interface type.

Mind you, the semantics of making a remote call are different than
just making a regular COM call (activation contexts, instancing, and the
like).

Do you already have the object set up for remote calls?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JCav" <jc********@cinci.rr.comwrote in message
news:47**********************@roadrunner.com...

>>>我需要使用C#从远程机器调用COM对象。我还需要
将不同的用户ID和密码传递给呼叫。有人做过这个吗?我使用Java来使用JIntegra来做这件事,但我使用的应用程序需要.NET。

任何建议?
>>>I need to call a COM object from a remote machine using C#. I also need
to pass on a different userID and password to the call. Has anyone done
this? I''ve used Java to do this using JIntegra, but the application I''m
using requires .NET.

Any advice?




这篇关于远程调用COM模拟其他用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆