【问题标题】:UWP VpnManagementAgent problems with credentialsUWP VpnManagementAgent 凭据问题
【发布时间】:2019-03-28 00:42:30
【问题描述】:

我正在尝试创建 vpn 配置文件并使用我的凭据连接到它。这是我的代码:

Profile = new VpnNativeProfile();
        Profile.AlwaysOn = true;
        Profile.NativeProtocolType = VpnNativeProtocolType.IpsecIkev2;
        Profile.ProfileName = VpnProfileName;
        Profile.RememberCredentials = false;
        Profile.RequireVpnClientAppUI = true;
        Profile.RoutingPolicyType = VpnRoutingPolicyType.ForceAllTrafficOverVpn;
        Profile.Servers.Add(myserver);
        Profile.UserAuthenticationMethod = VpnAuthenticationMethod.Eap;

        try
        {
            StorageFolder localFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
            string path = Path.Combine(localFolder.Path, "eap-conf.xml");
            Profile.EapConfiguration = File.ReadAllText(path);
        }
        catch
        {
            return false;
        }

        var profileres = await Agent.AddProfileFromObjectAsync(Profile);

已创建配置文件,然后尝试连接到它

VpnManagementErrorStatus status = await Agent.ConnectProfileWithPasswordCredentialAsync(Profile, new PasswordCredential
        {
            UserName = controller.Configuration.Id.ToString(),
            Password = controller.Configuration.Password
        });

而且它不工作,它要么进入无限等待,要么返回“其他”连接状态。 手动输入我的凭据效果很好,连接已建立。我试图从代码中调用连接,然后手动输入凭据,我看到了我的登录错误传递的原因

我将 Name 传递为“1005”,不带点或任何其他规范符号。将不胜感激任何提示或帮助,谢谢。

【问题讨论】:

  • 你能提供你的操作系统版本和SDK目标版本吗?
  • 我的操作系统版本是 1803(build 17134.345),sdk 目标版本是 1803(build 17134)最低版本是 build 15063

标签: c# uwp vpn


【解决方案1】:

我们遇到了同样的问题并找到了解决方案。 检查windows服务“路由和远程访问”(RemoteAccess)。在 Win10-1803 上,我们必须运行一个来解决问题。但是在 1809 上,该服务被禁用并且 VPN 成功启动。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多