Share via


WebApplicationFactory<TEntryPoint>.CreateServer Method

Definition

Overloads

Name Description
CreateServer(IWebHostBuilder)
Obsolete.

Creates the TestServer with the bootstrapped application in builder. This is only called for applications using IWebHostBuilder. Applications based on IHostBuilder will use CreateHost(IHostBuilder) instead.

CreateServer(IServiceProvider)

Creates the TestServer with the IServiceProvider from the bootstrapped application. This is only called for applications using IHostBuilder. Applications based on IWebHostBuilder will use CreateHost(IHostBuilder) instead.

CreateServer(IWebHostBuilder)

Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs
Source:
WebApplicationFactory.cs

Caution

IWebHost, which this method uses, is obsolete. Use one of the overloads that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.

Creates the TestServer with the bootstrapped application in builder. This is only called for applications using IWebHostBuilder. Applications based on IHostBuilder will use CreateHost(IHostBuilder) instead.

protected:
 virtual Microsoft::AspNetCore::TestHost::TestServer ^ CreateServer(Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ builder);
[System.Obsolete("IWebHost, which this method uses, is obsolete. Use one of the overloads that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId="ASPDEPR008", UrlFormat="https://aka.ms/aspnet/deprecate/008")]
protected virtual Microsoft.AspNetCore.TestHost.TestServer CreateServer(Microsoft.AspNetCore.Hosting.IWebHostBuilder builder);
protected virtual Microsoft.AspNetCore.TestHost.TestServer CreateServer(Microsoft.AspNetCore.Hosting.IWebHostBuilder builder);
[<System.Obsolete("IWebHost, which this method uses, is obsolete. Use one of the overloads that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId="ASPDEPR008", UrlFormat="https://aka.ms/aspnet/deprecate/008")>]
abstract member CreateServer : Microsoft.AspNetCore.Hosting.IWebHostBuilder -> Microsoft.AspNetCore.TestHost.TestServer
override this.CreateServer : Microsoft.AspNetCore.Hosting.IWebHostBuilder -> Microsoft.AspNetCore.TestHost.TestServer
abstract member CreateServer : Microsoft.AspNetCore.Hosting.IWebHostBuilder -> Microsoft.AspNetCore.TestHost.TestServer
override this.CreateServer : Microsoft.AspNetCore.Hosting.IWebHostBuilder -> Microsoft.AspNetCore.TestHost.TestServer
Protected Overridable Function CreateServer (builder As IWebHostBuilder) As TestServer

Parameters

builder
IWebHostBuilder

The IWebHostBuilder used to create the server.

Returns

The TestServer with the bootstrapped application.

Attributes

Applies to

CreateServer(IServiceProvider)

Source:
WebApplicationFactory.cs

Creates the TestServer with the IServiceProvider from the bootstrapped application. This is only called for applications using IHostBuilder. Applications based on IWebHostBuilder will use CreateHost(IHostBuilder) instead.

protected virtual Microsoft.AspNetCore.TestHost.TestServer CreateServer(IServiceProvider serviceProvider);
abstract member CreateServer : IServiceProvider -> Microsoft.AspNetCore.TestHost.TestServer
override this.CreateServer : IServiceProvider -> Microsoft.AspNetCore.TestHost.TestServer
Protected Overridable Function CreateServer (serviceProvider As IServiceProvider) As TestServer

Parameters

serviceProvider
IServiceProvider

The IServiceProvider from the bootstrapped application.

Returns

Applies to