共用方式為


ResourceBuilderExtensions.WithEndpoint Method

Definition

Overloads

WithEndpoint<T>(IResourceBuilder<T>, String, Action<EndpointAnnotation>, Boolean)

Changes an existing creates a new endpoint if it doesn't exist and invokes callback to modify the defaults.

WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>)

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

WithEndpoint<T>(IResourceBuilder<T>, String, Action<EndpointAnnotation>, Boolean)

Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs

Changes an existing creates a new endpoint if it doesn't exist and invokes callback to modify the defaults.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithEndpoint<T> (this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, string endpointName, Action<Aspire.Hosting.ApplicationModel.EndpointAnnotation> callback, bool createIfNotExists = true) where T : Aspire.Hosting.ApplicationModel.IResourceWithEndpoints;
static member WithEndpoint : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)> * string * Action<Aspire.Hosting.ApplicationModel.EndpointAnnotation> * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)
<Extension()>
Public Function WithEndpoint(Of T As IResourceWithEndpoints) (builder As IResourceBuilder(Of T), endpointName As String, callback As Action(Of EndpointAnnotation), Optional createIfNotExists As Boolean = true) As IResourceBuilder(Of T)

Type Parameters

T

Parameters

builder
IResourceBuilder<T>

Resource builder for resource with endpoints.

endpointName
String

Name of endpoint to change.

callback
Action<EndpointAnnotation>

Callback that modifies the endpoint.

createIfNotExists
Boolean

Create endpoint if it does not exist.

Returns

Applies to

WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>)

Source:
ResourceBuilderExtensions.cs
Source:
ResourceBuilderExtensions.cs

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

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

scheme
String

An optional scheme e.g. (http/https). Defaults to "tcp" if not specified.

name
String

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

env
String

An optional name of the environment variable that will be used to inject the targetPort. If the target port is null one will be dynamically generated and assigned to the environment variable.

isProxied
Boolean

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

isExternal
Nullable<Boolean>

Indicates that this endpoint should be exposed externally at publish time.

Returns

The IResourceBuilder<T>.

Exceptions

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

Applies to