This project is read-only.

Cannot connect in Windows Application running as Administrator

Oct 10, 2010 at 3:23 PM


I've written a simple DotRas application that dials a connection. It works wonderfully until I do Run as Administrator. If I run as Administrator, I get the following error in the event log:

CoId={6288E8BC-1D9D-4067-967E-B24673C2BA8F}: The user machine\user dialed a connection named 3G Connection which has failed. The error code returned on failure is 678.

In the application I get a RasException, with the message being "The connection was terminated."

Any idea why this works in unelevated mode but not as an administrator?

Oct 11, 2010 at 4:37 AM

I'm not exactly sure what could cause the problem off the top of my head, can't say I've seen it happen very much either. So, couple quick questions to start off the diagnostic process...

  1. Which operating system is causing the issue, and is it 32-bit or 64-bit?
  2. Which build are you using? For example: WIN2K, WINXP, WIN2K8, or WIN7
  3. What is the stack trace when the exception occurred? (Feel free to clear out any stack trace of your application, all I need is the DotRas project section of the stack trace).
  4. If you were using the RasDialer component, were you dialing synchronously (the Dial method) or asynchronously (the DialAsync method)?

We'll start with the standard questions, and see where it takes us.

- Jeff

Oct 11, 2010 at 12:41 PM

Actually I did a bit more debugging after posting this and discovered something interesting: The same issue occurs just by running rasdial.exe from an elevated Command Prompt instead of a normal one. I'm running Windows 7 x64. I know we've technically left the area covered by DotRas but I'm hoping you might share some of your expertise anyway since the end goal is to have it working from DotRas.

Not that its totally relevant anymore, but I was using the Win7 build and dialing synchronously.


Oct 11, 2010 at 2:37 PM

Windows 7 is a supported operating system with the 1.2 release, so I will do as much as I can to get the problem fixed. I'll see what I can find out but it might be something with Windows 7 since the remainder of RAS was placed under control of the UAC as of this operating system. If rasdial.exe is seeing the same issues it might be a problem within the RasDial API (which the RasDialer component uses).

Have you tried elevating the app permissions through the normal means instead of using the runas command?

Oct 11, 2010 at 2:41 PM

Actually I've been using a regularly elevated Command Prompt (right click Command Prompt, Run As Administrator). Runas doesn't work either though, just tried it.

Hopefully this is something that can be resolved because my next step was to dial a connection via a Windows Service, which is my ultimate goal.

Oct 11, 2010 at 2:42 PM

P.S. This should be fairly reproducible on your end -- just create a connection in the All Users phonebook and then use RasDial to dial the connection in an unelevated prompt and an elevated prompt.

Oct 11, 2010 at 4:24 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.