DevProxy.Hosting
0.2.1
dotnet add package DevProxy.Hosting --version 0.2.1
NuGet\Install-Package DevProxy.Hosting -Version 0.2.1
<PackageReference Include="DevProxy.Hosting" Version="0.2.1" />
<PackageVersion Include="DevProxy.Hosting" Version="0.2.1" />
<PackageReference Include="DevProxy.Hosting" />
paket add DevProxy.Hosting --version 0.2.1
#r "nuget: DevProxy.Hosting, 0.2.1"
#:package DevProxy.Hosting@0.2.1
#addin nuget:?package=DevProxy.Hosting&version=0.2.1
#tool nuget:?package=DevProxy.Hosting&version=0.2.1
Dev Proxy .NET Aspire extensions
Use Dev Proxy extensions for .NET Aspire to seamlessly integrate Dev Proxy into your distributed applications. Use Dev Proxy to:
- Verify how your distributed app handles API errors, both from your own services and third-party APIs
- Mock APIs while developing your app
- And more!
What This Package Does
The Dev Proxy .NET Aspire extensions allow you to easily add Dev Proxy as a resource in your distributed application. This package provides the following features:
- Add Dev Proxy as a container or executable resource to your application
- Configure Dev Proxy with custom arguments and bind mounts
- Integrate Dev Proxy with other services in your application
Usage
Here's how to add Dev Proxy's Docker container to your application:
using DevProxy.Hosting;
var builder = DistributedApplication
.CreateBuilder(args);
// Add an API service to the application
var apiService = builder.AddProject<Projects.AspireStarterApp_ApiService>("apiservice")
.WithHttpsHealthCheck("/health");
// Add Dev Proxy as a container resource
var devProxy = builder.AddDevProxyContainer("devproxy")
// specify the Dev Proxy configuration file
.WithConfigFile("./devproxy.json")
// mount the local folder with PFX certificate for intercepting HTTPS traffic
.WithCertFolder(".devproxy/cert")
// mount the local folder with Dev Proxy configuration
.WithConfigFolder(".devproxy/config")
// let Dev Proxy intercept requests to the API service
.WithUrlsToWatch(() => [$"{apiService.GetEndpoint("https").Url}/*"]);
// Add a web frontend project and configure it to use Dev Proxy
builder.AddProject<Projects.AspireStarterApp_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithHttpsHealthCheck("/health")
// set the HTTPS_PROXY environment variable to the Dev Proxy endpoint
.WithEnvironment("HTTPS_PROXY", devProxy.GetEndpoint(DevProxyResource.ProxyEndpointName))
.WithReference(apiService)
.WaitFor(apiService)
.WaitFor(devProxy);
// Build and run the application
builder.Build().Run();
If you have Dev Proxy installed locally, you can add it as a resource instead of using the Docker container.
using DevProxy.Hosting;
var builder = DistributedApplication
.CreateBuilder(args);
// Add an API service to the application
var apiService = builder.AddProject<Projects.AspireStarterApp_ApiService>("apiservice")
.WithHttpsHealthCheck("/health");
var devProxy = builder.AddDevProxyExecutable("devproxy")
.WithConfigFile(".devproxy/config/devproxy.json")
.WithUrlsToWatch(() => [$"{apiService.GetEndpoint("https").Url}/*"]);
// Add a web frontend project and configure it to use Dev Proxy
builder.AddProject<Projects.AspireStarterApp_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithHttpsHealthCheck("/health")
.WithEnvironment("HTTPS_PROXY", devProxy.GetEndpoint(DevProxyResource.ProxyEndpointName))
.WithReference(apiService)
.WaitFor(apiService)
.WaitFor(devProxy);
// Build and run the application
builder.Build().Run();
Key Features
- Container Resource: Use
AddDevProxyContainer
to run Dev Proxy as a containerized service. - Executable Resource: Use
AddDevProxyExecutable
to run Dev Proxy from the locally installed executable. - Custom Configuration: Use the extension methods to configure Dev Proxy as needed.
- Service Integration: Easily integrate Dev Proxy with other services in your application.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Projects
Product | Versions 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Aspire.Hosting (>= 9.4.0)
-
net9.0
- Aspire.Hosting (>= 9.4.0)
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 |
---|---|---|
0.2.1 | 155 | 8/5/2025 |
0.2.0 | 1,197 | 5/26/2025 |
0.1.0 | 162 | 5/19/2025 |
0.1.0-beta.1 | 154 | 5/9/2025 |