Cannot connect to VPN at the first time

Jan 28, 2015 at 10:08 AM

I tried to use "CreateAndDialVpnEntry" sample to create an entry and connect to my VPN server.

When I create an entry named "conn001" and click dial, it hangs at "Authenticate" about 1 minutes, and then shows:
DotRas.RasDialException: The remote connection was not made because the attempted VPN tunnels failed. The VPN server might be unreachable. If this connection is attempting to use an L2TP/IPsec tunnel, the security parameters required for IPsec negotiation might not be configured properly.

BUT if I double-click the "conn001" icon, it can be connected by Windows automatically.

After connected one time by Windows, I disconnected it and retried DotRas again, then it worked this time!

I then create another entry called "conn002" and Dialed with DotRas, still got the same error message.

The weird thing is, if I manually modify rasphone.pbk and replace "Guid" to the one of "conn001", it can be connected again, but if I change back to the one of "conn002", it failed again...

I'm sure the user/password is auto-filled already, unless there are some parameters of Dialer I missed? My environment is Win7 X64

Anyone can help me out?
Thank you.