Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written an OPC server that runs as a process that works correctly when invoked locally using COM. Based on my understanding, it is necessary to invoke my OPC server as a process at least without major rework since I am using a C++ process to load my C# OPC assembly. When invoked remotely and using DCOM, I am able to connect to my OPC server but I experience WCF failures that act like the process is running without 'Run As Administrator' permissions.

Firstly, I setup DCOM for my OPC server according to this document entitled OPC and DCOM: 5 Things you need to know. I created identical users on the server and client computers. For the DCOM Config, I set the Identity to be 'The launching user'. Ideally, I would have like to use 'This user' and specify the local properties but this was failing to even start my process locally.

When using DCOM and debugging my source, the user was correct and it appeared that it was invoked as the local user as part of the Administrator group. However, I observed WCF issues that I recognize resultant of lack of permissions.

1. I was unable to connect to a running Windows service using WCF named pipes. This is likely due to the fact that processes without elevated permissions are unable to connect to named pipe endpoints in the global space.

Example: Named Pipe Not Found

2. I attempted to create TCP service host that used port sharing and received the following message -
CSS
The service endpoint failed to listen on the URI <URI>
because access was denied.  Verify that the current user is granted access in the
appropriate allowAccounts section of SMSvcHost.exe.config.

This is similar to the ticket WCF with TCP Binding and Port Sharing which again indicated to 'Run as Administrator'
My SMSvcHost.exe.config files are configured to allow administrators to use TCP binding. If not, the locally connected process would not have been able to use TCP communication.

Is there any way to elevate the permissions of the current process? My best guess for a solution is that I need to spawn a process with elevated permissions.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900