0

我正在尝试在 DotRas 中指定 sstp 连接 - 我找到了一个示例如何做到这一点 -

RasDevice device = RasDevice.GetDeviceByName("(SSTP)", RasDeviceType.Vpn, false);
            if (device == null) throw new Exception("Cannot get RasDevice");
            RasEntry entry = RasEntry.CreateVpnEntry(connectionName, serverAddress, RasVpnStrategy.SstpOnly, device);

但在我RasVpnStrategy那里只有Default, L2tpFirst, L2tpOnly, PptpFirst,可用的PptpOnly字段。

我发现:

/// <summary>
    /// Defines the VPN strategies.
    /// </summary>
    public enum RasVpnStrategy
    {
        /// <summary>
        /// Dials PPTP first. If PPTP fails, L2TP is attempted.
        /// </summary>
        Default = 0,

        /// <summary>
        /// Dial PPTP only.
        /// </summary>
        PptpOnly = 1,

        /// <summary>
        /// Always dial PPTP first.
        /// </summary>
        PptpFirst = 2,

        /// <summary>
        /// Dial L2TP only.
        /// </summary>
        L2tpOnly = 3,

        /// <summary>
        /// Always dial L2TP first.
        /// </summary>
        L2tpFirst = 4,
#if (WIN2K8)
        /// <summary>
        /// Dial SSTP only.
        /// </summary>
        SstpOnly = 5,

        /// <summary>
        /// Always dial SSTP first.
        /// </summary>
        SstpFirst = 6
#endif
    }

所以,我什至不能在我的应用程序中指定 Sstp?(Win7)

4

3 回答 3

1

您至少需要引用 DotRas.dll 的 Win2k8 版本,然后您应该有 RasVpnStrategy.SstpOnly 和 RasVpnStrategy.SstpFirst 枚举选项。

于 2016-04-28T07:00:35.093 回答
0

即使在 W2K 程序集中,RasVpnStrategy.SstpOnly 和 RasVpnStrategy.SstpFirst 枚举选项似乎也不见了,但下面的代码对我有用。

var device = RasDevice.GetDevices().FirstOrDefault(d => d.Name.Contains("SSTP"));
RasEntry entry = RasEntry.CreateVpnEntry(entryName, ipAddress, (RasVpnStrategy)5, device);
于 2017-10-11T07:27:05.347 回答
-1

在当前的 DOTRAs 版本中这是不可能的 - 只有 PPTP/L2TP 可用。

于 2016-05-20T08:32:17.813 回答