MvcServiceCollectionExtensions.AddControllersWithViews 메서드

정의

오버로드

AddControllersWithViews(IServiceCollection)

지정된 IServiceCollection에 컨트롤러에 대한 서비스를 추가합니다. 이 메서드는 페이지에 사용되는 서비스를 등록하지 않습니다.

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

지정된 IServiceCollection에 컨트롤러에 대한 서비스를 추가합니다. 이 메서드는 페이지에 사용되는 서비스를 등록하지 않습니다.

AddControllersWithViews(IServiceCollection)

지정된 IServiceCollection에 컨트롤러에 대한 서비스를 추가합니다. 이 메서드는 페이지에 사용되는 서비스를 등록하지 않습니다.

public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddControllersWithViews (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddControllersWithViews : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddControllersWithViews (services As IServiceCollection) As IMvcBuilder

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

반환

IMvcBuilder MVC 서비스를 추가로 구성하는 데 사용할 수 있는 입니다.

설명

이 메서드는 보기가 있는 컨트롤러에서 일반적으로 사용되는 기능에 대해 MVC 서비스를 구성합니다. 이렇게 하면 , , AddApiExplorer(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder), AddFormatterMappings(IMvcCoreBuilder)AddViews(IMvcCoreBuilder)AddCacheTagHelper(IMvcCoreBuilder)AddCors(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder)및 의 AddMvcCore(IServiceCollection)효과가 결합됩니다.AddRazorViewEngine(IMvcCoreBuilder)

페이지에 대한 서비스를 추가하려면 를 호출 AddRazorPages(IServiceCollection)합니다.

적용 대상

AddControllersWithViews(IServiceCollection, Action<MvcOptions>)

지정된 IServiceCollection에 컨트롤러에 대한 서비스를 추가합니다. 이 메서드는 페이지에 사용되는 서비스를 등록하지 않습니다.

public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddControllersWithViews (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Mvc.MvcOptions> configure);
public static Microsoft.Extensions.DependencyInjection.IMvcBuilder AddControllersWithViews (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Mvc.MvcOptions>? configure);
static member AddControllersWithViews : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Mvc.MvcOptions> -> Microsoft.Extensions.DependencyInjection.IMvcBuilder
<Extension()>
Public Function AddControllersWithViews (services As IServiceCollection, configure As Action(Of MvcOptions)) As IMvcBuilder

매개 변수

services
IServiceCollection

서비스를 추가할 IServiceCollection입니다.

configure
Action<MvcOptions>

제공된 MvcOptions를 구성하는 Action<T>입니다.

반환

IMvcBuilder MVC 서비스를 추가로 구성하는 데 사용할 수 있는 입니다.

설명

이 메서드는 보기가 있는 컨트롤러에서 일반적으로 사용되는 기능에 대해 MVC 서비스를 구성합니다. 이렇게 하면 , , AddApiExplorer(IMvcCoreBuilder)AddAuthorization(IMvcCoreBuilder), AddFormatterMappings(IMvcCoreBuilder)AddViews(IMvcCoreBuilder)AddCacheTagHelper(IMvcCoreBuilder)AddCors(IMvcCoreBuilder)AddDataAnnotations(IMvcCoreBuilder)및 의 AddMvcCore(IServiceCollection)효과가 결합됩니다.AddRazorViewEngine(IMvcCoreBuilder)

페이지에 대한 서비스를 추가하려면 를 호출 AddRazorPages(IServiceCollection)합니다.

적용 대상