我创建了一个VPN配置文件,但未设置以下设置:名称,密码和身份验证方法。我试图以管理员身份运行项目,但它也没有起作用。有什么问题吗?
auto mgr = ref new VpnManagementAgent();
auto profile = ref new VpnNativeProfile();
profile->AlwaysOn = true;
profile->NativeProtocolType = VpnNativeProtocolType::L2tp;
profile->UserAuthenticationMethod = VpnAuthenticationMethod::PresharedKey;
profile->ProfileName = "TestVpn";
profile->RememberCredentials = true;
profile->RequireVpnClientAppUI = true;
profile->RoutingPolicyType = VpnRoutingPolicyType::ForceAllTrafficOverVpn;
profile->Servers->Append("101.99.74.214");
auto profileStatus = mgr->UpdateProfileFromObjectAsync(profile);
auto credentials = ref new PasswordCredential();
credentials->UserName = "vpn";
credentials->Password = "vpn";
auto connectStatus = mgr->ConnectProfileWithPasswordCredentialAsync(profile, credentials);