Operation Failed because the QueryInterface call on the COM component - The RPC server is unavailable

bryon 101 Reputation points
2022-10-10T19:38:27.133+00:00

Hello all - I am trying to set up a service on an old Widnows 2008 Server machine. Basically, I have a socket listener that connects to a client, the client makes a request. The request goes to the interop library, and it then throws the exception. The interop assembly basically accesses an application that is running on said machine. I created a console application that ran the server, and this functioned fine.

Whenever I make a call to an interop library I get the following exception:

System.InvalidCastException: Unable to cast COM object of type 'Csnt.ComDORTClass' to interface type 'Csnt.IComDORTClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{8C6A0426-E3F2-11CF-B34A-00AA003C435E}' failed due to the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Csnt.ComDORTClass.WriteDataItem(String lpcstrTagName, Int32 lValue)
at ComIntopCall.TrySetFlag(String strTagName, Boolean blnValue)
at IO.SomeService.ProcessWrite(String tag, String value, String type)
at Service.OnStart(String[] args)

I tried adding some rules to the firewall but that does not seem to have made much of a difference with the service still throwing the excecptions. The RPC service is running as well. The calls from the service are calling a local library.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,320 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,304 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,021 Reputation points
    2022-10-12T09:40:07.197+00:00

    Hello

    Thank you for your question and reaching out. I can understand you are having issues related to Services on 2008 server.

    Did you try to Disable any Antivirus program or Windows firewall completely you may have for temporary purpose.

    Also , please check if your Service is using old TLS and SSL ports as 2008 is legacy OS and it may not work on newer version of Operating systems due to enhanced security protocols.

    ---------------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answer--