使用RPC的问题 [英] Problems using RPC

查看:89
本文介绍了使用RPC的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在COM对象上执行RPC调用时遇到问题

通过Type.InvokeMember(.Net 2.0 Framework)。引发的异常是

HRESULT:0x800706BE,经过一些谷歌搜索,引导我到这个MS

支持页面:
http://support.microsoft.com/ ?scid = k ... 29080& x = 6& y = 12


问题是,这个页面指的是WIN XP,而我的开发和

生产机器是W2k3服务器(SP2,最新补丁级别)。在

开发机器上,该程序运行良好。在生产

机器上我得到上面的错误。


我的程序是Windows服务,它从COM获取数据

应用程序(这里RPC调用失败)并将其写入SQL数据库。


有没有人经历过同样的事情和/或有一个很好的建议来解决这个问题?


谢谢,

Tobi

Hi,

I am running into problems when performing an RPC call on a COM object
via Type.InvokeMember (.Net 2.0 Framework). The exception thrown is
"HRESULT: 0x800706BE", which, after some googling, leads me to this MS
Support Page:
http://support.microsoft.com/?scid=k...29080&x=6&y=12

Problem is, this page refers to WIN XP, whereas both my development and
production machines are W2k3 Servers (SP2, latest patch level). On the
development machine the program works perfectly fine. On the production
machine I get the error above.

My program is a Windows service, which fetches data from a COM
application (here the RPC call fails) and writes it to a SQL database.

Does anyone experienced the same and/or has a good suggestion to solve this?

Thanks,
Tobi

推荐答案

Tobias,


如何获得Type实例进行远程调用?

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Tobias Schr?er <到******************* @ gmx.dewrote in message

news:fm ********** @ news01.versatel.de ...
Tobias,

How are you getting the Type instance to make the remote call?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tobias Schr?er" <to*******************@gmx.dewrote in message
news:fm**********@news01.versatel.de...




我在执行RPC调用时遇到问题COM对象通过

Type.InvokeMember(.Net 2.0 Framework)。引发的异常是HRESULT:

0x800706BE,经过一些谷歌搜索后,我将进入MS支持页面:
http://support.microsoft.com/?scid=k...29080& ; x = 6& y = 12


问题是,这个页面指的是WIN XP,而我的开发和

生产机器都是W2k3服务器(SP2,最新补丁级别)。在

开发机器上,该程序运行良好。在生产

机器上我得到上面的错误。


我的程序是Windows服务,它从COM应用程序获取数据

(这里RPC调用失败)并将其写入SQL数据库。


有没有人经历过同样的事情和/或有一个很好的建议来解决

这个?


谢谢,

Tobi
Hi,

I am running into problems when performing an RPC call on a COM object via
Type.InvokeMember (.Net 2.0 Framework). The exception thrown is "HRESULT:
0x800706BE", which, after some googling, leads me to this MS Support Page:
http://support.microsoft.com/?scid=k...29080&x=6&y=12

Problem is, this page refers to WIN XP, whereas both my development and
production machines are W2k3 Servers (SP2, latest patch level). On the
development machine the program works perfectly fine. On the production
machine I get the error above.

My program is a Windows service, which fetches data from a COM application
(here the RPC call fails) and writes it to a SQL database.

Does anyone experienced the same and/or has a good suggestion to solve
this?

Thanks,
Tobi



对不起,


我应该添加一些代码。它来了:


< code>


//获取应用程序类型

类型appType =类型。 GetTypeFromProgID(" Prog.Id");

// app instance

object app = Activator.CreateInstance(appType);


// app数据库对象

object appDb = amAppType.InvokeMember(

" Database",

BindingFlags.InvokeMethod,
null,

app,

null);


//应用数据库类型

类型dbType = amDb.GetType();


//设置数据库名称

dbType.InvokeMember(

" ;名称",

BindingFlags.PutDispProperty,

null,

appDb,

new object [] {" ; DatabaseName"});


//找到的对象列表

this._objectList = new List< MyObject>();


//约束搜索

string whereClause =" myValue 0";


//首先搜索cord

int retVal =(Int32)dbType.InvokeMember(

" FindFirst",

BindingFlags.InvokeMethod,

null,

appDb,

new object [] {whereClause});


//循环,同时找到记录

while(retVal == 1){

//创建对象

MyObject obj = new MyObject();

//获取数据

obj.MyProperty =(string)dbType.InvokeMember(

" GetContentsByName",

BindingFlags.InvokeMethod,

null,

amDb,

new object [] {" MyPropertyFieldName" });

//添加到列表

this._objectList.Add(obj);


//下一个

retVal =(Int32)dbType.InvokeMember(

" FindNext",

BindingFlags.InvokeMethod,

null ,

appDb,

null);

}


< / code>


Nicholas Paldino [.NET / C#MVP] schrieb:
Sorry,

I should have added some code. Here it comes:

<code>

// get application type
Type appType = Type.GetTypeFromProgID("Prog.Id");
// app instance
object app = Activator.CreateInstance(appType);

// app database object
object appDb = amAppType.InvokeMember(
"Database",
BindingFlags.InvokeMethod,
null,
app,
null);

// app databasee type
Type dbType = amDb.GetType();

// set database name
dbType.InvokeMember(
"Name",
BindingFlags.PutDispProperty,
null,
appDb,
new object[] { "DatabaseName" });

// list of found objects
this._objectList = new List<MyObject>();

// constrain search
string whereClause = "myValue 0";

// search first record
int retVal = (Int32)dbType.InvokeMember(
"FindFirst",
BindingFlags.InvokeMethod,
null,
appDb,
new object[] { whereClause });

// loop, while records found
while (retVal == 1) {
// create object
MyObject obj = new MyObject();
// get data
obj.MyProperty = (string)dbType.InvokeMember(
"GetContentsByName",
BindingFlags.InvokeMethod,
null,
amDb,
new object[] { "MyPropertyFieldName" });
// add to list
this._objectList.Add(obj);

// get next
retVal = (Int32)dbType.InvokeMember(
"FindNext",
BindingFlags.InvokeMethod,
null,
appDb,
null);
}

</code>

Nicholas Paldino [.NET/C# MVP] schrieb:

Tobias,


如何获得Type实例进行远程调用?

Tobias,

How are you getting the Type instance to make the remote call?


Tobias,


如何在远程计算机上调用此设置?您是否在COM +中的本地计算机上安装了

代理,其程序ID为

" Prog.Id"?如果没有,那么你应该调用

GetTypeFromProgID的重载,它取你想要制作的机器名称

远程调用。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Tobias Schr?er" <到******************* @ gmx.dewrote in message

news:fm ********** @ news01.versatel.de ...
Tobias,

How is this set up to be called on a remote machine? Do you have a
proxy installed on the local machine in COM+ which has a program id of
"Prog.Id"? If not, then you should be calling the overload of
GetTypeFromProgID which takes the name of the machine which you want to make
the remote call to.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tobias Schr?er" <to*******************@gmx.dewrote in message
news:fm**********@news01.versatel.de...

对不起,


我应该添加一些代码。它来了:


< code>


//获取应用程序类型

类型appType =类型。 GetTypeFromProgID(" Prog.Id");

// app instance

object app = Activator.CreateInstance(appType);


// app数据库对象

object appDb = amAppType.InvokeMember(

" Database",

BindingFlags.InvokeMethod,
null,

app,

null);


//应用数据库类型

类型dbType = amDb.GetType();


//设置数据库名称

dbType.InvokeMember(

" ;名称",

BindingFlags.PutDispProperty,

null,

appDb,

new object [] {" ; DatabaseName"});


//找到的对象列表

this._objectList = new List< MyObject>();


//约束搜索

string whereClause =" myValue 0";


//搜索第一条记录

int retVal =(Int32)dbType.InvokeMember(

FindFirst,

BindingFlags.InvokeMethod,

null,

appDb,

new object [] { whereClause});


//循环,同时找到记录

while(retVal == 1){

//创建对象

MyObject obj = new MyObject();

//获取数据

obj.MyProperty =(string)dbType.InvokeMember(

" GetContentsByName",

BindingFlags.InvokeMethod,

null,

amDb,

new object [] {" MyPropertyFieldName" });

//添加到列表

this._objectList.Add(obj);


//下一个

retVal =(Int32)dbType.InvokeMember(

" FindNext",

BindingFlags.InvokeMethod,

null ,

appDb,

null);

}


< / code>


Nicholas Paldino [.NET / C#MVP] schrieb:
Sorry,

I should have added some code. Here it comes:

<code>

// get application type
Type appType = Type.GetTypeFromProgID("Prog.Id");
// app instance
object app = Activator.CreateInstance(appType);

// app database object
object appDb = amAppType.InvokeMember(
"Database",
BindingFlags.InvokeMethod,
null,
app,
null);

// app databasee type
Type dbType = amDb.GetType();

// set database name
dbType.InvokeMember(
"Name",
BindingFlags.PutDispProperty,
null,
appDb,
new object[] { "DatabaseName" });

// list of found objects
this._objectList = new List<MyObject>();

// constrain search
string whereClause = "myValue 0";

// search first record
int retVal = (Int32)dbType.InvokeMember(
"FindFirst",
BindingFlags.InvokeMethod,
null,
appDb,
new object[] { whereClause });

// loop, while records found
while (retVal == 1) {
// create object
MyObject obj = new MyObject();
// get data
obj.MyProperty = (string)dbType.InvokeMember(
"GetContentsByName",
BindingFlags.InvokeMethod,
null,
amDb,
new object[] { "MyPropertyFieldName" });
// add to list
this._objectList.Add(obj);

// get next
retVal = (Int32)dbType.InvokeMember(
"FindNext",
BindingFlags.InvokeMethod,
null,
appDb,
null);
}

</code>

Nicholas Paldino [.NET/C# MVP] schrieb:

> Tobias,

如何你得到Type实例进行远程调用吗?
>Tobias,

How are you getting the Type instance to make the remote call?


这篇关于使用RPC的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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