CommunityToolkit.Aspire.Hosting.Ngrok 9.1.1-beta.152

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.Hosting.Ngrok.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Hosting.Ngrok --version 9.1.1-beta.152                
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Ngrok -Version 9.1.1-beta.152                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Ngrok" Version="9.1.1-beta.152" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CommunityToolkit.Aspire.Hosting.Ngrok --version 9.1.1-beta.152                
#r "nuget: CommunityToolkit.Aspire.Hosting.Ngrok, 9.1.1-beta.152"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CommunityToolkit.Aspire.Hosting.Ngrok as a Cake Addin
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Ngrok&version=9.1.1-beta.152&prerelease

// Install CommunityToolkit.Aspire.Hosting.Ngrok as a Cake Tool
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Ngrok&version=9.1.1-beta.152&prerelease                

CommunityToolkit.Aspire.Hosting.Ngrok library

Provides extension methods and resource definitions for a .NET Aspire AppHost to configure a ngrok container.

Getting Started

Install the package

In your AppHost project, install the package using the following command:

dotnet add package CommunityToolkit.Aspire.Hosting.Ngrok

Example usage

Then, in the Program.cs file of app host, add a ngrok resource and add endpoints to be tunneled following methods:

var myService = builder.AddProject<Projects.MyService>();
var otherSevice = builder.AddProject<Projects.OtherService>();

var authToken = builder
    .AddParameter("ngrok-auth-token", "your-ngrok-auth-token", secret: true);

builder.AddNgrok("ngrok", endpointPort: 59600) // omit endpointPort to use random port
    .WithAuthToken(authToken)
    .WithTunnelEndpoint(myService, "http", "<your-ngrok-domain>")
    .WithTunnelEndpoint(otherSevice, "http"); // ngrok will generate a random domain for this service

Querying the ngrok tunneled endpoints

After the ngrok container has started, you can query the ngrok tunneled endpoints using api exposed by the ngrok container:

curl -H "Accept: application/json" -s http://localhost:59600/api/tunnels

This will return a JSON response with the ngrok tunneled endpoints.

{
  "tunnels": [
    {
      "name": "my-http",
      "ID": "5baa78f84cffb31a96cccf5bbe992451",
      "uri": "/api/tunnels/my-http",
      "public_url": "https://<your-ngrok-domain>",
      "proto": "https",
      "config": {
        "addr": "http://host.docker.internal:5165",
        "inspect": true
      },
      // ...
    }, {
      "name": "other-http",
      "ID": "f7f1351d1307e3615ca7de310bf6bb61",
      "uri": "/api/tunnels/other-http",
      "public_url": "https://0849-94-134-176-242.ngrok-free.app",
      "proto": "https",
      "config": {
          "addr": "http://host.docker.internal:3657",
          "inspect": true
      },
      // ...
    }
  ],
  "uri": "/api/tunnels"
}

Additional Information

Feedback & contributing

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.1.1-beta.169 34 2/6/2025
9.1.1-beta.168 28 2/5/2025
9.1.1-beta.166 34 2/5/2025
9.1.1-beta.165 28 2/5/2025
9.1.1-beta.164 36 2/3/2025
9.1.1-beta.162 36 2/3/2025
9.1.1-beta.155 31 1/30/2025
9.1.1-beta.154 26 1/30/2025
9.1.1-beta.153 27 1/30/2025
9.1.1-beta.152 9 1/29/2025
9.1.1-beta.150 31 1/29/2025
9.1.1-beta.148 35 1/26/2025
9.1.1-beta.147 28 1/26/2025
9.1.1-beta.146 31 1/23/2025
9.1.1-beta.145 29 1/22/2025
9.1.1-beta.144 29 1/22/2025
9.1.1-beta.142 30 1/22/2025
9.1.1-beta.140 33 1/22/2025
9.1.1-beta.139 31 1/21/2025
9.1.1-beta.138 30 1/20/2025
9.1.1-beta.137 32 1/17/2025
9.1.1-beta.136 32 1/15/2025
9.1.1-beta.135 12 1/15/2025
9.1.1-beta.134 10 1/15/2025