UWP VPN - VpnPlugin connect implementation throws exception in StartWithMainTransportdetecting a VPN connection in Windows?Establish a VPN connection in cmdCheckpoint VPN issue: Connectivity with VPN service is lostCarouselPanel in UWP throwing exceptionConnecting to VPN stops UWP apps internet communicationCreating a VPN connection in PowerShellHow can I set the endpoint of a VPN Native Plugin in UWP?UWP create VPN connectionUWP, VPN authentication with app container certificatesHow to connect to the MS-SSTP VPN server from C# UWP application?

Biological Blimps: Propulsion

How should I respond when I lied about my education and the company finds out through background check?

A social experiment. What is the worst that can happen?

How do I color the graph in datavisualization?

WiFi Thermostat, No C Terminal on Furnace

How to explain what's wrong with this application of the chain rule?

Is it better practice to read straight from sheet music rather than memorize it?

Delivering sarcasm

Why did the EU agree to delay the Brexit deadline?

Create all possible words using a set or letters

Which one is correct as adjective “protruding” or “protruded”?

Count the occurrence of each unique word in the file

Where did Heinlein say "Once you get to Earth orbit, you're halfway to anywhere in the Solar System"?

Is there a working SACD iso player for Ubuntu?

What is Cash Advance APR?

Closed-form expression for certain product

What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?

Lowest total scrabble score

Argument list too long when zipping large list of certain files in a folder

Strong empirical falsification of quantum mechanics based on vacuum energy density

Loading commands from file

On a tidally locked planet, would time be quantized?

What is the evidence for the "tyranny of the majority problem" in a direct democracy context?

Should I outline or discovery write my stories?



UWP VPN - VpnPlugin connect implementation throws exception in StartWithMainTransport


detecting a VPN connection in Windows?Establish a VPN connection in cmdCheckpoint VPN issue: Connectivity with VPN service is lostCarouselPanel in UWP throwing exceptionConnecting to VPN stops UWP apps internet communicationCreating a VPN connection in PowerShellHow can I set the endpoint of a VPN Native Plugin in UWP?UWP create VPN connectionUWP, VPN authentication with app container certificatesHow to connect to the MS-SSTP VPN server from C# UWP application?













0















Kindly see the UWP code snippet below tried on Windows 10 desktop using Visual Studio 2017 community edition.



The code implements Custom IVpnPlugin module. When system's VPN configuration is selected to this app and connect is done, the application's task gets triggered and VPN plugin's "Connect()" method gets invoked.



However, following code steps face exception while executing StartWithMainTransport(…).
("The operation was cancelled by user") on Visual Studio.
On the system's VPN settings following error is seen - "remote access service ip configuration is unusable"



I think I am passing correctly v4 and v6 address to the channel->StartWithMainTransport(…) API which are bound to my m/c network I/f. What other validations may have caused this issue. I do not want to configure certificates etc for the VpnChannel as I plan to implement encapsulate and decapsulate myself in VpnPlugin.



// Sample Plugin's connect implementation 
void TunnelPlugin::Connect(Windows::Networking::Vpn::VpnChannel^ channel)

this->dSock = ref new DatagramSocket();
channel->AssociateTransport(this->dSock, nullptr); // No difference even if this statement is moved after ConnectAsync().
Platform::String^ svcName = "22111";
auto result = create_task(dSock->BindServiceNameAsync(svcName));
result.get();
// Connect to the destination tunnel address on UDP socket.
HostName^ remoteTunnelIP = ref new HostName("192.168.1.137");
Platform::String^ remoteTunnelPort = "22112";
result = create_task(this->dSock->ConnectAsync(remoteTunnelIP, remoteTunnelPort));
result.get();

VpnChannelConfiguration^ chanCfg = channel->Configuration;
// IP destinations to be routed via VPN
VpnRouteAssignment^ routeScope = ref new VpnRouteAssignment();
routeScope->Ipv4InclusionRoutes->Append(ref new VpnRoute(ref new HostName("192.168.1.111"), 32));
Vector<HostName^>^ localV4Addrs = ref new Vector<HostName^>;
localV4Addrs->Append(ref new HostName("192.168.1.133")); // Local host name to be bound.
Vector<HostName^>^ localV6Addrs = ref new Vector<HostName^>;
localV6Addrs->Append(ref new HostName("fc00::44fd:d3ed:b02a:a05e"));
Vector<HostName^>^ dnsServers = ref new Vector<HostName^>;
dnsServers->Append(ref new HostName("1.1.1.1"));
VpnDomainNameInfo^ dnsInfo = ref new VpnDomainNameInfo(".", VpnDomainNameType::Suffix, dnsServers, ref new Vector<HostName^>);
VpnDomainNameAssignment^ dnsAssignment = ref new VpnDomainNameAssignment;
dnsAssignment->DomainNameList->Append(dnsInfo);

try

// Throws exception here.
channel->StartWithMainTransport(localV4Addrs->GetView(), localV6Addrs->GetView(), nullptr, routeScope, dnsAssignment, 1400, 1412, false, this->dSock);

catch (Exception^ exc)

auto type = exc->GetType();
Platform::String^ str = exc->ToString();











share|improve this question







New contributor




default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0















    Kindly see the UWP code snippet below tried on Windows 10 desktop using Visual Studio 2017 community edition.



    The code implements Custom IVpnPlugin module. When system's VPN configuration is selected to this app and connect is done, the application's task gets triggered and VPN plugin's "Connect()" method gets invoked.



    However, following code steps face exception while executing StartWithMainTransport(…).
    ("The operation was cancelled by user") on Visual Studio.
    On the system's VPN settings following error is seen - "remote access service ip configuration is unusable"



    I think I am passing correctly v4 and v6 address to the channel->StartWithMainTransport(…) API which are bound to my m/c network I/f. What other validations may have caused this issue. I do not want to configure certificates etc for the VpnChannel as I plan to implement encapsulate and decapsulate myself in VpnPlugin.



    // Sample Plugin's connect implementation 
    void TunnelPlugin::Connect(Windows::Networking::Vpn::VpnChannel^ channel)

    this->dSock = ref new DatagramSocket();
    channel->AssociateTransport(this->dSock, nullptr); // No difference even if this statement is moved after ConnectAsync().
    Platform::String^ svcName = "22111";
    auto result = create_task(dSock->BindServiceNameAsync(svcName));
    result.get();
    // Connect to the destination tunnel address on UDP socket.
    HostName^ remoteTunnelIP = ref new HostName("192.168.1.137");
    Platform::String^ remoteTunnelPort = "22112";
    result = create_task(this->dSock->ConnectAsync(remoteTunnelIP, remoteTunnelPort));
    result.get();

    VpnChannelConfiguration^ chanCfg = channel->Configuration;
    // IP destinations to be routed via VPN
    VpnRouteAssignment^ routeScope = ref new VpnRouteAssignment();
    routeScope->Ipv4InclusionRoutes->Append(ref new VpnRoute(ref new HostName("192.168.1.111"), 32));
    Vector<HostName^>^ localV4Addrs = ref new Vector<HostName^>;
    localV4Addrs->Append(ref new HostName("192.168.1.133")); // Local host name to be bound.
    Vector<HostName^>^ localV6Addrs = ref new Vector<HostName^>;
    localV6Addrs->Append(ref new HostName("fc00::44fd:d3ed:b02a:a05e"));
    Vector<HostName^>^ dnsServers = ref new Vector<HostName^>;
    dnsServers->Append(ref new HostName("1.1.1.1"));
    VpnDomainNameInfo^ dnsInfo = ref new VpnDomainNameInfo(".", VpnDomainNameType::Suffix, dnsServers, ref new Vector<HostName^>);
    VpnDomainNameAssignment^ dnsAssignment = ref new VpnDomainNameAssignment;
    dnsAssignment->DomainNameList->Append(dnsInfo);

    try

    // Throws exception here.
    channel->StartWithMainTransport(localV4Addrs->GetView(), localV6Addrs->GetView(), nullptr, routeScope, dnsAssignment, 1400, 1412, false, this->dSock);

    catch (Exception^ exc)

    auto type = exc->GetType();
    Platform::String^ str = exc->ToString();











    share|improve this question







    New contributor




    default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      Kindly see the UWP code snippet below tried on Windows 10 desktop using Visual Studio 2017 community edition.



      The code implements Custom IVpnPlugin module. When system's VPN configuration is selected to this app and connect is done, the application's task gets triggered and VPN plugin's "Connect()" method gets invoked.



      However, following code steps face exception while executing StartWithMainTransport(…).
      ("The operation was cancelled by user") on Visual Studio.
      On the system's VPN settings following error is seen - "remote access service ip configuration is unusable"



      I think I am passing correctly v4 and v6 address to the channel->StartWithMainTransport(…) API which are bound to my m/c network I/f. What other validations may have caused this issue. I do not want to configure certificates etc for the VpnChannel as I plan to implement encapsulate and decapsulate myself in VpnPlugin.



      // Sample Plugin's connect implementation 
      void TunnelPlugin::Connect(Windows::Networking::Vpn::VpnChannel^ channel)

      this->dSock = ref new DatagramSocket();
      channel->AssociateTransport(this->dSock, nullptr); // No difference even if this statement is moved after ConnectAsync().
      Platform::String^ svcName = "22111";
      auto result = create_task(dSock->BindServiceNameAsync(svcName));
      result.get();
      // Connect to the destination tunnel address on UDP socket.
      HostName^ remoteTunnelIP = ref new HostName("192.168.1.137");
      Platform::String^ remoteTunnelPort = "22112";
      result = create_task(this->dSock->ConnectAsync(remoteTunnelIP, remoteTunnelPort));
      result.get();

      VpnChannelConfiguration^ chanCfg = channel->Configuration;
      // IP destinations to be routed via VPN
      VpnRouteAssignment^ routeScope = ref new VpnRouteAssignment();
      routeScope->Ipv4InclusionRoutes->Append(ref new VpnRoute(ref new HostName("192.168.1.111"), 32));
      Vector<HostName^>^ localV4Addrs = ref new Vector<HostName^>;
      localV4Addrs->Append(ref new HostName("192.168.1.133")); // Local host name to be bound.
      Vector<HostName^>^ localV6Addrs = ref new Vector<HostName^>;
      localV6Addrs->Append(ref new HostName("fc00::44fd:d3ed:b02a:a05e"));
      Vector<HostName^>^ dnsServers = ref new Vector<HostName^>;
      dnsServers->Append(ref new HostName("1.1.1.1"));
      VpnDomainNameInfo^ dnsInfo = ref new VpnDomainNameInfo(".", VpnDomainNameType::Suffix, dnsServers, ref new Vector<HostName^>);
      VpnDomainNameAssignment^ dnsAssignment = ref new VpnDomainNameAssignment;
      dnsAssignment->DomainNameList->Append(dnsInfo);

      try

      // Throws exception here.
      channel->StartWithMainTransport(localV4Addrs->GetView(), localV6Addrs->GetView(), nullptr, routeScope, dnsAssignment, 1400, 1412, false, this->dSock);

      catch (Exception^ exc)

      auto type = exc->GetType();
      Platform::String^ str = exc->ToString();











      share|improve this question







      New contributor




      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      Kindly see the UWP code snippet below tried on Windows 10 desktop using Visual Studio 2017 community edition.



      The code implements Custom IVpnPlugin module. When system's VPN configuration is selected to this app and connect is done, the application's task gets triggered and VPN plugin's "Connect()" method gets invoked.



      However, following code steps face exception while executing StartWithMainTransport(…).
      ("The operation was cancelled by user") on Visual Studio.
      On the system's VPN settings following error is seen - "remote access service ip configuration is unusable"



      I think I am passing correctly v4 and v6 address to the channel->StartWithMainTransport(…) API which are bound to my m/c network I/f. What other validations may have caused this issue. I do not want to configure certificates etc for the VpnChannel as I plan to implement encapsulate and decapsulate myself in VpnPlugin.



      // Sample Plugin's connect implementation 
      void TunnelPlugin::Connect(Windows::Networking::Vpn::VpnChannel^ channel)

      this->dSock = ref new DatagramSocket();
      channel->AssociateTransport(this->dSock, nullptr); // No difference even if this statement is moved after ConnectAsync().
      Platform::String^ svcName = "22111";
      auto result = create_task(dSock->BindServiceNameAsync(svcName));
      result.get();
      // Connect to the destination tunnel address on UDP socket.
      HostName^ remoteTunnelIP = ref new HostName("192.168.1.137");
      Platform::String^ remoteTunnelPort = "22112";
      result = create_task(this->dSock->ConnectAsync(remoteTunnelIP, remoteTunnelPort));
      result.get();

      VpnChannelConfiguration^ chanCfg = channel->Configuration;
      // IP destinations to be routed via VPN
      VpnRouteAssignment^ routeScope = ref new VpnRouteAssignment();
      routeScope->Ipv4InclusionRoutes->Append(ref new VpnRoute(ref new HostName("192.168.1.111"), 32));
      Vector<HostName^>^ localV4Addrs = ref new Vector<HostName^>;
      localV4Addrs->Append(ref new HostName("192.168.1.133")); // Local host name to be bound.
      Vector<HostName^>^ localV6Addrs = ref new Vector<HostName^>;
      localV6Addrs->Append(ref new HostName("fc00::44fd:d3ed:b02a:a05e"));
      Vector<HostName^>^ dnsServers = ref new Vector<HostName^>;
      dnsServers->Append(ref new HostName("1.1.1.1"));
      VpnDomainNameInfo^ dnsInfo = ref new VpnDomainNameInfo(".", VpnDomainNameType::Suffix, dnsServers, ref new Vector<HostName^>);
      VpnDomainNameAssignment^ dnsAssignment = ref new VpnDomainNameAssignment;
      dnsAssignment->DomainNameList->Append(dnsInfo);

      try

      // Throws exception here.
      channel->StartWithMainTransport(localV4Addrs->GetView(), localV6Addrs->GetView(), nullptr, routeScope, dnsAssignment, 1400, 1412, false, this->dSock);

      catch (Exception^ exc)

      auto type = exc->GetType();
      Platform::String^ str = exc->ToString();








      windows uwp vpn






      share|improve this question







      New contributor




      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      default sdefault s

      11




      11




      New contributor




      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      default s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          default s is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281362%2fuwp-vpn-vpnplugin-connect-implementation-throws-exception-in-startwithmaintran%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          default s is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          default s is a new contributor. Be nice, and check out our Code of Conduct.












          default s is a new contributor. Be nice, and check out our Code of Conduct.











          default s is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281362%2fuwp-vpn-vpnplugin-connect-implementation-throws-exception-in-startwithmaintran%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript