DotRas 错误 "The value 'gre' is not supported for conversion."

DotRas Error "The value 'gre' is not supported for conversion."

我正在使用 vb.net 和 DotRas SDK https://archive.codeplex.com/?p=dotras 我有一个问题,如果我尝试执行示例,我总是会收到错误 "The value 'gre' is not supported for conversion."

一定是调用错误

RasDevice.GetDevice

完整调用为:

Dim entry As RasEntry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn))

有没有人知道问题可能是什么,或者如何解决?

我正在使用 Windows Server 2016 64Bit

谢谢!

编辑:

Public Class MainForm
    Public Const EntryName As String = "VPN Connection"
    Private connectionHandle As RasHandle

    Private Sub CreateEntryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateEntryButton.Click
        ' This opens the phonebook so it can be used. Different overloads here will determine where the phonebook is opened/created.
        Me.AllUsersPhoneBook.Open()

        Dim device = RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn)
        Dim entry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default, device)


        ' Add the new entry to the phone book.
        Me.AllUsersPhoneBook.Entries.Add(entry)
    End Sub

不幸的是,旧的 API 无法处理来自 Windows 的意外值,因为这是较新类型的设备。

您可能需要升级到支持它的 2.0 版本(但是它们现在处于预览状态)。

如果您有兴趣,项目站点也已移至 https://github.com/winnster/DotRas GitHub。