我正在使用带有 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