0

我正在使用带有 DotRas SDK https://archive.codeplex.com/?p=dotras的 vb.net 我有一个问题,如果我尝试执行该示例,我总是收到错误“值 'gre' 不是支持转换。”

一定是调用错误

RasDevice.GetDevice

完整的调用是:

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

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

我正在使用 Windows Server 2016 64 位

谢谢!

编辑:

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
4

1 回答 1

0

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

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

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

于 2019-08-05T10:17:09.850 回答