CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Brussels
    Posts
    6

    RPC, Service & dll : RPC_S_DUPLICATE_ENDPOINT (1740)

    Hi everyone

    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.

    Benoit

  2. #2
    Join Date
    Oct 2010
    Posts
    1

    Talking 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;
    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.

    Regards from Peru.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured