June 3rd, 2003, 02:54 AM
RPC, Service & dll : RPC_S_DUPLICATE_ENDPOINT (1740)
Here are my problems
I have developped a service that is accessible via RPC.
This service is called by another program via a dll.
1. When the service is started, we can see that it uses 5 threads (in the task manager window). When it is called by the dll and it is running, it uses 7 threads. Once the call is finished and the Binding has been released, it uses 6 threads and not 5 as it did before having run once. Why is that?
2. When we stop the service and try to restart it, we sometimes get the message RPC_S_DUPLICATE_ENDPOINT (1740) which means "The endpoint is a duplicate" and the service does not start correctly but stays pending in a "starting" state. The only way to restart the service afterwards is to restart the computer, which is really annoying. What does it really mean ? Does it mean that when the service stopped, it was still in use, called by my dll ? This latter problem does not occur everytime we restart the service but only from time to time, and the problem only occurs on Windows 2000 and not on Windows NT.
Any help, idea, tip would be great.
Thanks to all in advance.
October 26th, 2010, 09:19 AM
Re: RPC, Service & dll : RPC_S_DUPLICATE_ENDPOINT (1740)
Hi, i had the same problem, i can't fixed totally, but this code works for me:
UCHAR* pszProtocolSequence = (UCHAR*)"ncacn_ip_tcp";
UCHAR* pszSecurity = NULL;
UCHAR* pszEndpoint = (UCHAR*)"9300";
UINT cMinCalls = 1;
UINT cMaxCalls = m_dwConcurrentChannels;
UINT fDontWait = FALSE;
int RPC_tries, MAX_RPC_Tries;
status = ::RpcServerUseProtseqEp(
pszProtocolSequence, cMaxCalls, pszEndpoint, pszSecurity);
}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.
Regards from Peru.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!