Skip to content
Docs Try Aspire

YarpResourceExtensions

Class static net8.0
📦 Aspire.Hosting.Yarp v13.2.0
Provides extension methods for adding YARP resources to the application model.
namespace Aspire.Hosting;
public static class YarpResourceExtensions
{
// ...
}
AddYarp(IDistributedApplicationBuilder, string)extensionats export
IResourceBuilder<YarpResource>
Adds a YARP container to the application model.
PublishWithStaticFiles(IResourceBuilder<YarpResource>, IResourceBuilder<IResourceWithContainerFiles>)extensionats export
IResourceBuilder<YarpResource>
In publish mode, generates a Dockerfile that copies static files from the specified resource into /app/wwwroot.
WithConfiguration(IResourceBuilder<YarpResource>, Action<IYarpConfigurationBuilder>)extensionats export
IResourceBuilder<YarpResource>
Configure the YARP resource.
WithHostHttpsPort(IResourceBuilder<YarpResource>, int?)extensionats export
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?)extensionats export
IResourceBuilder<YarpResource>
Configures the host port that the YARP resource is exposed on instead of using randomly assigned port.
WithStaticFiles(IResourceBuilder<YarpResource>)extensionats export
IResourceBuilder<YarpResource>
Enables static file serving in the YARP resource. Static files are served from the wwwroot folder.
WithStaticFiles(IResourceBuilder<YarpResource>, string)extensionats export
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