Using Inspectr with .NET
Inspectr is a powerful tool when working with .NET web APIs. You can use it to debug incoming requests, inspect headers and payloads, and expose your local .NET services for webhook testing or external integrations.
This guide shows how to use Inspectr as a proxy in front of your .NET application.
Prerequisites
Section titled “Prerequisites”- .NET SDK installed (Install .NET →)
- Inspectr installed (Install guide →)
- A running .NET Web API project (e.g., built with ASP.NET Core)
Step 1: Create or Start Your .NET Web API
Section titled “Step 1: Create or Start Your .NET Web API”You can use the .NET CLI to scaffold a new API:
dotnet new webapi -n MyApiAppcd MyApiAppdotnet run
By default, this runs on http://localhost:5000
.
Step 2: Start Inspectr as a Proxy
Section titled “Step 2: Start Inspectr as a Proxy”Run Inspectr and forward traffic to your running .NET backend:
inspectr --listen=:8080 --backend=http://localhost:5000
Now, any requests made to http://localhost:8080
will be:
- Logged in the terminal
- Captured in the Inspectr App UI (http://localhost:4004)
- Forwarded to your .NET API
Example request:
Section titled “Example request:”curl http://localhost:8080/weatherforecast
Optional: Expose Your API Publicly
Section titled “Optional: Expose Your API Publicly”You can expose your .NET API to the internet via Inspectr’s Ingress relay:
inspectr \ --listen=:8080 \ --backend=http://localhost:5000 \ --expose \ --channel=dotnet-app \ --channel-code=dotnet123
Your API will now be available at:
https://dotnet-app.in-spectr.dev
Step 3: Inspect and Debug
Section titled “Step 3: Inspect and Debug”Use the Inspectr App to:
- View request/response bodies, status codes, and headers
- Replay requests to test your endpoints
- Catch malformed or unauthorized requests
- Log activity during development or integration testing
Summary
Section titled “Summary”Using Inspectr with .NET APIs allows you to:
- Debug traffic in real time
- Replay incoming requests for testing
- Expose services for external integrations or webhook development