共用方式為


DistributedApplicationHostingTestingExtensions.CreateHttpClient Method

Definition

Creates an HttpClient configured to communicate with the specified resource.

public static System.Net.Http.HttpClient CreateHttpClient (this Aspire.Hosting.DistributedApplication app, string resourceName, string? endpointName = default);
static member CreateHttpClient : Aspire.Hosting.DistributedApplication * string * string -> System.Net.Http.HttpClient
<Extension()>
Public Function CreateHttpClient (app As DistributedApplication, resourceName As String, Optional endpointName As String = Nothing) As HttpClient

Parameters

app
DistributedApplication

The application.

resourceName
String

The resourceName of the resource.

endpointName
String

The resourceName of the endpoint on the resource to communicate with.

Returns

The HttpClient.

Applies to