“终点是重复的”当启动RPC服务器时 [英] "endpoint is a duplicate" when starting an RPC server

查看:585
本文介绍了“终点是重复的”当启动RPC服务器时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序使用Microsoft RPC进行进程间通信。为了准备接收RPC调用,程序运行以下序列:


  1. RpcServerUseProtseqEp(),然后


  2. RpcServerListen()


程序按照上述顺序启动其RPC服务器,工作一段时间,然后终止,稍后可以由另一个程序重新启动。每次运行程序时,RpcServerUseProtseqEp()的参数值集合是相同的。



当重新启动后第一次运行序列时,它总是成功,后续运行RpcServerUseProtseqEp()返回RPC_S_DUPLICATE_ENDPOINT(端点是重复的)目前我只是忽略这个特定的错误代码,并将其视为成功,那么所有其他原语通常工作正常。



使用RpcServerUseProtseqEp()的正确方法是什么?我应该做任何清理撤销注册的端点或只是继续忽略RPC_S_DUPLICATE_ENDPOINT错误代码?

解决方案

我有同样的问题,我不能完全固定,但是这段代码适用于我:

  UCHAR * pszProtocolSequence =(UCHAR *)ncacn_ip_tcp; //通过TCP / IP使用RPC 
UCHAR * pszSecurity = NULL;
UCHAR * pszEndpoint =(UCHAR *)9300;
UINT cMinCalls = 1;
UINT cMaxCalls = m_dwConcurrentChannels;
UINT fDontWait = FALSE;

int RPC_tries,MAX_RPC_Tries;
RPC_tries = 0;
MAX_RPC_Tries = 60;
do
{
status = :: RpcServerUseProtseqEp(
pszProtocolSequence,cMaxCalls,pszEndpoint,pszSecurity);
Sleep(1000);
RPC_tries + = 1;
} while(status!= RPC_S_OK&& RPC_tries< MAX_RPC_Tries);

由于某种原因,您必须等待一段时间,直到重新启动Windows服务时再次使用RpcServerUseProtseqEp。 / p>

My program uses Microsoft RPC for interprocess communications. To prepare for receiving RPC calls the program runs the following sequence:

  1. RpcServerUseProtseqEp(), then

  2. RpcServerRegisterIf(), then

  3. RpcServerListen()

The program starts its RPC server with the sequence above, works for some time, then terminates and may later be restarted by another program. The set of parameters values for RpcServerUseProtseqEp() is the same each time the program is run.

When the sequence is run the first time after reboot it always succeeds, but on subsequent runs RpcServerUseProtseqEp() returns RPC_S_DUPLICATE_ENDPOINT ("The endpoint is a duplicate.") Currently I just ignore this particular error code and treat it as success, then all the other primitives usually work fine.

What is the correct way of using RpcServerUseProtseqEp()? Should I do any cleanup to revoke the registered endpoint or just keep ignoring the RPC_S_DUPLICATE_ENDPOINT error code?

解决方案

i had the same problem, i can't fixed totally, but this code works for me:

UCHAR* pszProtocolSequence = (UCHAR*)"ncacn_ip_tcp"; // Use RPC over TCP/IP
UCHAR* pszSecurity = NULL;
UCHAR* pszEndpoint = (UCHAR*)"9300";
UINT cMinCalls = 1;
UINT cMaxCalls = m_dwConcurrentChannels;
UINT fDontWait = FALSE;

int RPC_tries, MAX_RPC_Tries;
RPC_tries=0;
MAX_RPC_Tries=60;
do
{
    status = ::RpcServerUseProtseqEp(
    pszProtocolSequence, cMaxCalls, pszEndpoint, pszSecurity);
    Sleep(1000);
    RPC_tries+=1;
}while(status!=RPC_S_OK && RPC_tries<MAX_RPC_Tries);

For some reason you have to wait some time until use RpcServerUseProtseqEp again when you restart a windows service.

这篇关于“终点是重复的”当启动RPC服务器时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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