WebApplicationFactory<TEntryPoint>.UseKestrel Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
UseKestrel() |
Configures the factory to use Kestrel as the server. |
UseKestrel(Action<KestrelServerOptions>) |
Configures the factory to use Kestrel as the server. |
UseKestrel(Int32) |
Configures the factory to use Kestrel as the server. |
UseKestrel()
- Source:
- WebApplicationFactory.cs
Configures the factory to use Kestrel as the server.
public void UseKestrel();
member this.UseKestrel : unit -> unit
Public Sub UseKestrel ()
Applies to
UseKestrel(Action<KestrelServerOptions>)
- Source:
- WebApplicationFactory.cs
Configures the factory to use Kestrel as the server.
public void UseKestrel(Action<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions> configureKestrelOptions);
member this.UseKestrel : Action<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions> -> unit
Public Sub UseKestrel (configureKestrelOptions As Action(Of KestrelServerOptions))
Parameters
- configureKestrelOptions
- Action<KestrelServerOptions>
A callback handler that will be used for configuring the server when it starts.
Exceptions
Thrown, if this method is called after the WebHostFactory has been initialized.
Remarks
This method should be called before the factory is initialized either via one of the CreateClient() methods or via the StartServer() method.
Applies to
UseKestrel(Int32)
- Source:
- WebApplicationFactory.cs
Configures the factory to use Kestrel as the server.
public void UseKestrel(int port);
member this.UseKestrel : int -> unit
Public Sub UseKestrel (port As Integer)
Parameters
- port
- Int32
The port to listen to when the server starts. Use 0
to allow dynamic port selection.
Exceptions
Thrown, if this method is called after the WebHostFactory has been initialized.
Remarks
This method should be called before the factory is initialized either via one of the CreateClient() methods or via the StartServer() method.