Share via


ResourceBuilderExtensions.WithHttpEndpoint<T> Method

Definition

Exposes an HTTP endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be "http" if not specified.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithHttpEndpoint<T> (this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, int? port = default, int? targetPort = default, string? name = default, string? env = default, bool isProxied = true) where T : Aspire.Hosting.ApplicationModel.IResourceWithEndpoints;
static member WithHttpEndpoint : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)> * Nullable<int> * Nullable<int> * string * string * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)
<Extension()>
Public Function WithHttpEndpoint(Of T As IResourceWithEndpoints) (builder As IResourceBuilder(Of T), Optional port As Nullable(Of Integer) = Nothing, Optional targetPort As Nullable(Of Integer) = Nothing, Optional name As String = Nothing, Optional env As String = Nothing, Optional isProxied As Boolean = true) As IResourceBuilder(Of T)

Type Parameters

T

The resource type.

Parameters

builder
IResourceBuilder<T>

The resource builder.

port
Nullable<Int32>

An optional port. This is the port that will be given to other resource to communicate with this resource.

targetPort
Nullable<Int32>

This is the port the resource is listening on. If the endpoint is used for the container, it is the container port.

name
String

An optional name of the endpoint. Defaults to "http" if not specified.

env
String

An optional name of the environment variable to inject.

isProxied
Boolean

Specifies if the endpoint will be proxied by DCP. Defaults to true.

Returns

The IResourceBuilder<T>.

Exceptions

Throws an exception if an endpoint with the same name already exists on the specified resource.

Applies to