Skip to content
Docs Try Aspire

YarpResourceExtensions

Class static net10.0
📦 Aspire.Hosting.Yarp v13.1.2
Provides extension methods for adding YARP resources to the application model.
namespace Aspire.Hosting;
public static class YarpResourceExtensions
{
// ...
}
AddYarp(IDistributedApplicationBuilder, string)extension
IResourceBuilder<YarpResource>
Adds a YARP container to the application model.
PublishWithStaticFiles(IResourceBuilder<YarpResource>, IResourceBuilder<IResourceWithContainerFiles>)extension
IResourceBuilder<YarpResource>
In publish mode, generates a Dockerfile that copies static files from the specified resource into /app/wwwroot.
WithConfiguration(IResourceBuilder<YarpResource>, Action<IYarpConfigurationBuilder>)extension
IResourceBuilder<YarpResource>
Configure the YARP resource.
WithHostHttpsPort(IResourceBuilder<YarpResource>, int?)extension
IResourceBuilder<YarpResource>
Configures the host HTTPS port that the YARP resource is exposed on instead of using randomly assigned port. This will only have effect if an HTTPS endpoint is configured on the YARP resource due to TLS termination being enabled.
WithHostPort(IResourceBuilder<YarpResource>, int?)extension
IResourceBuilder<YarpResource>
Configures the host port that the YARP resource is exposed on instead of using randomly assigned port.
WithStaticFiles(IResourceBuilder<YarpResource>)extension
IResourceBuilder<YarpResource>
Enables static file serving in the YARP resource. Static files are served from the wwwroot folder.
WithStaticFiles(IResourceBuilder<YarpResource>, string)extension
IResourceBuilder<YarpResource>
Enables static file serving. In run mode: bind mounts sourcePath to /wwwroot. In publish mode: generates a Dockerfile whose build context is sourcePath and copies its contents into /app/wwwroot baked into the image.
View all methods