Web hosting windows asp

4 лучших ASP.NET хостингов на Windows для размещения веб-приложений и сайтов

Microsoft Windows — одна из самых популярных операционных систем, используемых во многих офисах и домах.

Эта самая продаваемая операционная система также имеет различные версии серверов, которые служат основой многих решений для веб-хостинга.

Однако большинство услуг хостинга работают на серверах на базе Unix из-за их надежности, безопасности, скорости и отличной программной экосистемы с лучшими приложениями.

Несмотря на все эти преимущества, Linux не подходит всем. Если ваш веб-сайт основан на технологиях Microsoft, таких как .NET или ASP.NET, и вы хотите использовать облачные решения Microsoft, вам нужно будет выбрать хостинг на Windows.

Не говоря уже о том, что Windows развивалась с годами, стала популярной и воспринималась как безопасный выбор, отвечающий вашим требованиям. Кроме того, выбор хостинга Windows не означает, что вы ограничены использованием только продуктов Microsoft

Многие хостинги предлагают простую установку полезных приложений, таких как IIS, WordPress, Drupal, Joomla и другие, а также готовые функции, которые сделают процесс разработки увлекательным.

Немного о хостингах на Windows и ASP.NET

В хостингах на Windows, сервер использует Microsoft Windows в качестве основной операционной системы.

Windows хостинги поставляется с популярным приложением, включая Internet Information Services (IIS). Он также поддерживает основные базы данных и языки программирования, включая PHP, ASP.NET, Microsoft SQL и другие.

Что касается ASP.NET, то это среда веб-приложений, разработанная Microsoft. Эта структура позволяет разработчикам создавать веб-службы, веб-приложения и динамические веб-приложения.

Давайте рассмотрим некоторые из его преимуществ.

Знакомая оболочка

Вероятность того, что вы уже использовали Windows раньше, высока, учитывая ее огромную популярность. Следовательно, ваше знакомство с системой прокладывает путь при настройке хостинг-сервера путем запуска программного обеспечения в вашей системе.

Но если вы используете ОС на базе Unix, вам потребуются знания и опыт работы с интерфейсом командной строки. Не всем это понравится. И даже если вы узнаете, как его использовать, просмотрев несколько руководств, одна неверная команда может привести к сбою вашего приложения или сайта на ваших глазах или, возможно, открыть лазейку в безопасности.

Портативность

Если вам нужно перенести свой сайт с хостинга Windows на Linux, переход будет плавным. Это также применимо к обратному сценарию, когда вы перемещаете свой сайт или приложения, размещенные в другой серверной операционной системе, в Windows. Следовательно, это увеличивает ваше удобство, если вы хотите внести определенные изменения в будущем.

Гибкость

Уровень гибкости, который обеспечивает хостинг на Windows, не имеет себе равных. Вы можете запустить IIS или Apache в качестве серверного программного обеспечения, реплицировать свой стек LAMP или добиться большей гибкости.

Регулярные обновления программного обеспечения

Microsoft периодически обновляет свое программное обеспечение и операционную систему. В результате вы получаете последние исправления безопасности, чтобы гарантировать безопасность ваших приложений и сайта.

Итак, вы готовы разместить свое приложение ASP.NET на Windows?

Я предполагаю, что ДА!

Давайте раскроем для этого лучшие хостинговые платформы Windows

1. HostGator

Весь процесс размещения ваших приложений ASP.NET становится простым благодаря комплексным услугам HostGator. У него есть планы, отвечающие вашим конкретным потребностям, и лучшие в своем классе функции по лучшей цене.

Он предлагает невероятную гибкость и мощность благодаря Parallels Plesk Panel, Microsoft SQL Server-2008 R2, Internet Information Services (IIS), а также более 4000 шаблонов и бесплатных инструментов для создания сайтов.

HostGator гарантирует 99,9% времени безотказной работы для своего хостинга Windows, бесплатные SSL-сертификаты для безопасности сайта и 35+ скриптов, устанавливаемых бесплатно с помощью простых щелчков мышью. Вы получаете такие функции электронной почты, как неограниченное количество учетных записей POP3 с поддержкой SMTP, IMAP, доступ к веб-почте, неограниченное количество автоответчиков, псевдонимы электронной почты, пересылка почты и 25 списков рассылки.

Помимо этого, вы также получаете Microsoft SQL, MySQL, базы данных Access, а также установку различных скриптов одним щелчком мыши. Планы хостинга включают в себя надежные инструменты администрирования, такие как Webalizer, AWStats, Raw Log Manager, веб-файловый менеджер, защищенные паролем каталоги, запланированные задачи и многое другое.

Стоимость хостинга HostGator для Windows начинается от менее 5 долларов в месяц за 1 домен и неограниченную пропускную способность и дисковое пространство. Он также включает 45-дневную гарантию возврата денег.

2. Everleap

Everleap — это эффективное, масштабируемое и сбалансированное решение облачного хостинга для ASP.NET, созданное разработчиками .NET. Он доступен по хорошей цене и может стать хорошей альтернативой AWS или Azure, заставляя вас влюбиться в его решения. Когда дело доходит до миграции, они делают это без дополнительных затрат.

По мере развития технологии приложений ASP.NET растет и потребность в дополнительных ресурсах для обеспечения производительности. Помня об этом, они разработали время отклика сервера Everleap, чтобы быть действительно быстрым по сравнению со многими его конкурентами.

Everleap поддерживает различные используемые вами инструменты, такие как Visual Studio Express, Git, FTP, LightSwitch, Expression Web, WebMatrix и другие.

Его планы начинаются от 20 долларов в месяц для одного сайта. Попробуйте Everleap бесплатно в течение 30 дней и определите, стоит ли тратить на него ваши деньги.

3. Microsoft Azure

Теперь идет хостинг, которого вы, должно быть, ожидаете — Microsoft Azure. Начните сборку вашего приложения с помощью .NET, Node.js, Python и Java в вашей Windows. Он предоставляет вам полностью управляемую хостинговую платформу с установкой исправлений для ОС, балансировкой нагрузки, оптимизированными серверами и выделением емкости.

Настраивайте на портале Azure или в интерфейсе командной строки или используйте встроенные шаблоны для развертывания в один щелчок. Повысьте продуктивность и ускорите процесс разработки с помощью интеграции исходного кода из GitHub, публикации в один щелчок через Visual Studio IDE и отладки в реальном времени.

Получите подробную статистику об использовании ресурсов и пропускной способности вашего приложения, использовании ЦП, памяти, тенденциях ошибок и времени ответа с помощью Azure Monitor. Воспользуйтесь преимуществами гибридной согласованности, поскольку вы можете создавать приложения и управлять ими как в локальной среде, так и в облаке.

Читайте также:  Установка сетевого принтера windows 10 через роутер

Azure соответствует таким стандартам безопасности, как ISO, PCI, SOC2, и обеспечивает SLA корпоративного уровня. Интегрируйтесь с тысячами приложений SaaS в облаке, такими как Dropbox, Salesforce, Office 365, Concur и другими.

4. HostPresto

И последнее, но не менее важное в этом списке: HostPresto также является хорошим вариантом, который вы можете использовать для размещения своих приложений ASP.NET. Все их службы хостинга Windows оснащены панелью управления — Plesk для простого и централизованного управления учетной записью.

Вы получаете бесплатные сертификаты SSL, которыми вы можете управлять из самого Plesk, например добавлять, удалять, подписывать запросы и т. Д. Они обеспечивают современное управление клиентами вместе с приложениями для выставления счетов, которые помогают вам легко управлять своим бизнесом.

HostPresto позволяет устанавливать такие приложения, как WordPress, Joomla и другие, одним щелчком мыши. Вы получаете бесплатные резервные копии ежедневно, а также возможность безопасного и безопасного восстановления определенных папок и файлов.

Другие функции, включенные в планы хостинга, — это сверхбыстрый SSD, неограниченная пропускная способность, бесплатный домен и 99,9% времени безотказной работы для всех планов. HostPresto не взимает с вас плату за перенос учетной записи, а также нет никаких контрактов или платы за установку.

ASP.NET Core Web Host

ASP.NET Core apps configure and launch a host. The host is responsible for app startup and lifetime management. At a minimum, the host configures a server and a request processing pipeline. The host can also set up logging, dependency injection, and configuration.

This article covers the Web Host, which remains available only for backward compatibility. The ASP.NET Core templates create a .NET Generic Host, which is recommended for all app types.

This article covers the Web Host, which is for hosting web apps. For other kinds of apps, use the Generic Host.

Set up a host

Create a host using an instance of IWebHostBuilder. This is typically performed in the app’s entry point, the Main method.

In the project templates, Main is located in Program.cs. A typical app calls CreateDefaultBuilder to start setting up a host:

The code that calls CreateDefaultBuilder is in a method named CreateWebHostBuilder , which separates it from the code in Main that calls Run on the builder object. This separation is required if you use Entity Framework Core tools. The tools expect to find a CreateWebHostBuilder method that they can call at design time to configure the host without running the app. An alternative is to implement IDesignTimeDbContextFactory . For more information, see Design-time DbContext Creation.

CreateDefaultBuilder performs the following tasks:

  • Configures Kestrel server as the web server using the app’s hosting configuration providers. For the Kestrel server’s default options, see Configure options for the ASP.NET Core Kestrel web server.
  • Configures Kestrel server as the web server using the app’s hosting configuration providers. For the Kestrel server’s default options, see Kestrel web server implementation in ASP.NET Core.
  • Sets the content root to the path returned by Directory.GetCurrentDirectory.
  • Loads host configuration from:
    • Environment variables prefixed with ASPNETCORE_ (for example, ASPNETCORE_ENVIRONMENT ).
    • Command-line arguments.
  • Loads app configuration in the following order from:
    • appsettings.json.
    • appsettings..json.
    • User secrets when the app runs in the Development environment using the entry assembly.
    • Environment variables.
    • Command-line arguments.
  • Configures logging for console and debug output. Logging includes log filtering rules specified in a Logging configuration section of an appsettings.json or appsettings..json file.
  • When running behind IIS with the ASP.NET Core Module, CreateDefaultBuilder enables IIS Integration, which configures the app’s base address and port. IIS Integration also configures the app to capture startup errors. For the IIS default options, see Host ASP.NET Core on Windows with IIS.
  • Sets ServiceProviderOptions.ValidateScopes to true if the app’s environment is Development. For more information, see Scope validation.

The configuration defined by CreateDefaultBuilder can be overridden and augmented by ConfigureAppConfiguration, ConfigureLogging, and other methods and extension methods of IWebHostBuilder. A few examples follow:

ConfigureAppConfiguration is used to specify additional IConfiguration for the app. The following ConfigureAppConfiguration call adds a delegate to include app configuration in the appsettings.xml file. ConfigureAppConfiguration may be called multiple times. Note that this configuration doesn’t apply to the host (for example, server URLs or environment). See the Host configuration values section.

The following ConfigureLogging call adds a delegate to configure the minimum logging level (SetMinimumLevel) to LogLevel.Warning. This setting overrides the settings in appsettings.Development.json ( LogLevel.Debug ) and appsettings.Production.json ( LogLevel.Error ) configured by CreateDefaultBuilder . ConfigureLogging may be called multiple times.

The following call to ConfigureKestrel overrides the default Limits.MaxRequestBodySize of 30,000,000 bytes established when Kestrel was configured by CreateDefaultBuilder :

The following call to UseKestrel overrides the default Limits.MaxRequestBodySize of 30,000,000 bytes established when Kestrel was configured by CreateDefaultBuilder :

The content root determines where the host searches for content files, such as MVC view files. When the app is started from the project’s root folder, the project’s root folder is used as the content root. This is the default used in Visual Studio and the dotnet new templates.

For more information on app configuration, see Configuration in ASP.NET Core.

As an alternative to using the static CreateDefaultBuilder method, creating a host from WebHostBuilder is a supported approach with ASP.NET Core 2.x.

When setting up a host, Configure and ConfigureServices methods can be provided. If a Startup class is specified, it must define a Configure method. For more information, see App startup in ASP.NET Core. Multiple calls to ConfigureServices append to one another. Multiple calls to Configure or UseStartup on the WebHostBuilder replace previous settings.

Host configuration values

WebHostBuilder relies on the following approaches to set the host configuration values:

  • Host builder configuration, which includes environment variables with the format ASPNETCORE_ . For example, ASPNETCORE_ENVIRONMENT .
  • Extensions such as UseContentRoot and UseConfiguration (see the Override configuration section).
  • UseSetting and the associated key. When setting a value with UseSetting , the value is set as a string regardless of the type.

The host uses whichever option sets a value last. For more information, see Override configuration in the next section.

Application Key (Name)

The IWebHostEnvironment.ApplicationName property is automatically set when UseStartup or Configure is called during host construction. The value is set to the name of the assembly containing the app’s entry point. To set the value explicitly, use the WebHostDefaults.ApplicationKey:

The IHostingEnvironment.ApplicationName property is automatically set when UseStartup or Configure is called during host construction. The value is set to the name of the assembly containing the app’s entry point. To set the value explicitly, use the WebHostDefaults.ApplicationKey:

Key: applicationName
Type: string
Default: The name of the assembly containing the app’s entry point.
Set using: UseSetting
Environment variable: ASPNETCORE_APPLICATIONNAME

Capture Startup Errors

This setting controls the capture of startup errors.

Key: captureStartupErrors
Type: bool ( true or 1 )
Default: Defaults to false unless the app runs with Kestrel behind IIS, where the default is true .
Set using: CaptureStartupErrors
Environment variable: ASPNETCORE_CAPTURESTARTUPERRORS

When false , errors during startup result in the host exiting. When true , the host captures exceptions during startup and attempts to start the server.

Content root

This setting determines where ASP.NET Core begins searching for content files.

Key: contentRoot
Type: string
Default: Defaults to the folder where the app assembly resides.
Set using: UseContentRoot
Environment variable: ASPNETCORE_CONTENTROOT

The content root is also used as the base path for the web root. If the content root path doesn’t exist, the host fails to start.

For more information, see:

Detailed Errors

Determines if detailed errors should be captured.

Key: detailedErrors
Type: bool ( true or 1 )
Default: false
Set using: UseSetting
Environment variable: ASPNETCORE_DETAILEDERRORS

When enabled (or when the Environment is set to Development ), the app captures detailed exceptions.

Environment

Sets the app’s environment.

Key: environment
Type: string
Default: Production
Set using: UseEnvironment
Environment variable: ASPNETCORE_ENVIRONMENT

The environment can be set to any value. Framework-defined values include Development , Staging , and Production . Values aren’t case sensitive. By default, the Environment is read from the ASPNETCORE_ENVIRONMENT environment variable. When using Visual Studio, environment variables may be set in the launchSettings.json file. For more information, see Use multiple environments in ASP.NET Core.

Hosting Startup Assemblies

Sets the app’s hosting startup assemblies.

Key: hostingStartupAssemblies
Type: string
Default: Empty string
Set using: UseSetting
Environment variable: ASPNETCORE_HOSTINGSTARTUPASSEMBLIES

A semicolon-delimited string of hosting startup assemblies to load on startup.

Although the configuration value defaults to an empty string, the hosting startup assemblies always include the app’s assembly. When hosting startup assemblies are provided, they’re added to the app’s assembly for loading when the app builds its common services during startup.

HTTPS Port

Set the HTTPS redirect port. Used in enforcing HTTPS.

Key: https_port
Type: string
Default: A default value isn’t set.
Set using: UseSetting
Environment variable: ASPNETCORE_HTTPS_PORT

Hosting Startup Exclude Assemblies

A semicolon-delimited string of hosting startup assemblies to exclude on startup.

Key: hostingStartupExcludeAssemblies
Type: string
Default: Empty string
Set using: UseSetting
Environment variable: ASPNETCORE_HOSTINGSTARTUPEXCLUDEASSEMBLIES

Prefer Hosting URLs

Indicates whether the host should listen on the URLs configured with the WebHostBuilder instead of those configured with the IServer implementation.

Key: preferHostingUrls
Type: bool ( true or 1 )
Default: true
Set using: PreferHostingUrls
Environment variable: ASPNETCORE_PREFERHOSTINGURLS

Prevent Hosting Startup

Prevents the automatic loading of hosting startup assemblies, including hosting startup assemblies configured by the app’s assembly. For more information, see Use hosting startup assemblies in ASP.NET Core.

Key: preventHostingStartup
Type: bool ( true or 1 )
Default: false
Set using: UseSetting
Environment variable: ASPNETCORE_PREVENTHOSTINGSTARTUP

Server URLs

Indicates the IP addresses or host addresses with ports and protocols that the server should listen on for requests.

Key: urls
Type: string
Default: http://localhost:5000
Set using: UseUrls
Environment variable: ASPNETCORE_URLS

Set to a semicolon-separated (;) list of URL prefixes to which the server should respond. For example, http://localhost:123 . Use «*» to indicate that the server should listen for requests on any IP address or hostname using the specified port and protocol (for example, http://*:5000 ). The protocol ( http:// or https:// ) must be included with each URL. Supported formats vary among servers.

Kestrel has its own endpoint configuration API. For more information, see Configure endpoints for the ASP.NET Core Kestrel web server.

Kestrel has its own endpoint configuration API. For more information, see Kestrel web server implementation in ASP.NET Core.

Shutdown Timeout

Specifies the amount of time to wait for Web Host to shut down.

Key: shutdownTimeoutSeconds
Type: int
Default: 5
Set using: UseShutdownTimeout
Environment variable: ASPNETCORE_SHUTDOWNTIMEOUTSECONDS

Although the key accepts an int with UseSetting (for example, .UseSetting(WebHostDefaults.ShutdownTimeoutKey, «10») ), the UseShutdownTimeout extension method takes a TimeSpan.

During the timeout period, hosting:

  • Triggers IApplicationLifetime.ApplicationStopping.
  • Attempts to stop hosted services, logging any errors for services that fail to stop.

If the timeout period expires before all of the hosted services stop, any remaining active services are stopped when the app shuts down. The services stop even if they haven’t finished processing. If services require additional time to stop, increase the timeout.

Startup Assembly

Determines the assembly to search for the Startup class.

Key: startupAssembly
Type: string
Default: The app’s assembly
Set using: UseStartup
Environment variable: ASPNETCORE_STARTUPASSEMBLY

The assembly by name ( string ) or type ( TStartup ) can be referenced. If multiple UseStartup methods are called, the last one takes precedence.

Web root

Sets the relative path to the app’s static assets.

Key: webroot
Type: string
Default: The default is wwwroot . The path to /wwwroot must exist. If the path doesn’t exist, a no-op file provider is used.
Set using: UseWebRoot
Environment variable: ASPNETCORE_WEBROOT

For more information, see:

Override configuration

Use Configuration to configure Web Host. In the following example, host configuration is optionally specified in a hostsettings.json file. Any configuration loaded from the hostsettings.json file may be overridden by command-line arguments. The built configuration (in config ) is used to configure the host with UseConfiguration. IWebHostBuilder configuration is added to the app’s configuration, but the converse isn’t true— ConfigureAppConfiguration doesn’t affect the IWebHostBuilder configuration.

Overriding the configuration provided by UseUrls with hostsettings.json config first, command-line argument config second:

UseConfiguration only copies keys from the provided IConfiguration to the host builder configuration. Therefore, setting reloadOnChange: true for JSON, INI, and XML settings files has no effect.

To specify the host run on a particular URL, the desired value can be passed in from a command prompt when executing dotnet run. The command-line argument overrides the urls value from the hostsettings.json file, and the server listens on port 8080:

Manage the host

Run

The Run method starts the web app and blocks the calling thread until the host is shut down:

Start

Run the host in a non-blocking manner by calling its Start method:

If a list of URLs is passed to the Start method, it listens on the URLs specified:

The app can initialize and start a new host using the pre-configured defaults of CreateDefaultBuilder using a static convenience method. These methods start the server without console output and with WaitForShutdown wait for a break (Ctrl-C/SIGINT or SIGTERM):

Start(RequestDelegate app)

Start with a RequestDelegate :

Make a request in the browser to http://localhost:5000 to receive the response «Hello World!» WaitForShutdown blocks until a break (Ctrl-C/SIGINT or SIGTERM) is issued. The app displays the Console.WriteLine message and waits for a keypress to exit.

Start(string url, RequestDelegate app)

Start with a URL and RequestDelegate :

Produces the same result as Start(RequestDelegate app), except the app responds on http://localhost:8080 .

Start(Action routeBuilder)

Use an instance of IRouteBuilder (Microsoft.AspNetCore.Routing) to use routing middleware:

Use the following browser requests with the example:

Request Response
http://localhost:5000/hello/Martin Hello, Martin!
http://localhost:5000/buenosdias/Catrina Buenos dias, Catrina!
http://localhost:5000/throw/ooops! Throws an exception with string «ooops!»
http://localhost:5000/throw Throws an exception with string «Uh oh!»
http://localhost:5000/Sante/Kevin Sante, Kevin!
http://localhost:5000 Hello World!

WaitForShutdown blocks until a break (Ctrl-C/SIGINT or SIGTERM) is issued. The app displays the Console.WriteLine message and waits for a keypress to exit.

Start(string url, Action routeBuilder)

Use a URL and an instance of IRouteBuilder :

Produces the same result as Start(Action routeBuilder), except the app responds at http://localhost:8080 .

StartWith(Action app)

Provide a delegate to configure an IApplicationBuilder :

Make a request in the browser to http://localhost:5000 to receive the response «Hello World!» WaitForShutdown blocks until a break (Ctrl-C/SIGINT or SIGTERM) is issued. The app displays the Console.WriteLine message and waits for a keypress to exit.

StartWith(string url, Action app)

Provide a URL and a delegate to configure an IApplicationBuilder :

Produces the same result as StartWith(Action app), except the app responds on http://localhost:8080 .

IWebHostEnvironment interface

The IWebHostEnvironment interface provides information about the app’s web hosting environment. Use constructor injection to obtain the IWebHostEnvironment in order to use its properties and extension methods:

A convention-based approach can be used to configure the app at startup based on the environment. Alternatively, inject the IWebHostEnvironment into the Startup constructor for use in ConfigureServices :

In addition to the IsDevelopment extension method, IWebHostEnvironment offers IsStaging , IsProduction , and IsEnvironment(string environmentName) methods. For more information, see Use multiple environments in ASP.NET Core.

The IWebHostEnvironment service can also be injected directly into the Configure method for setting up the processing pipeline:

IWebHostEnvironment can be injected into the Invoke method when creating custom middleware:

IHostingEnvironment interface

The IHostingEnvironment interface provides information about the app’s web hosting environment. Use constructor injection to obtain the IHostingEnvironment in order to use its properties and extension methods:

A convention-based approach can be used to configure the app at startup based on the environment. Alternatively, inject the IHostingEnvironment into the Startup constructor for use in ConfigureServices :

In addition to the IsDevelopment extension method, IHostingEnvironment offers IsStaging , IsProduction , and IsEnvironment(string environmentName) methods. For more information, see Use multiple environments in ASP.NET Core.

The IHostingEnvironment service can also be injected directly into the Configure method for setting up the processing pipeline:

IHostingEnvironment can be injected into the Invoke method when creating custom middleware:

IHostApplicationLifetime interface

IHostApplicationLifetime allows for post-startup and shutdown activities. Three properties on the interface are cancellation tokens used to register Action methods that define startup and shutdown events.

Cancellation Token Triggered when…
ApplicationStarted The host has fully started.
ApplicationStopped The host is completing a graceful shutdown. All requests should be processed. Shutdown blocks until this event completes.
ApplicationStopping The host is performing a graceful shutdown. Requests may still be processing. Shutdown blocks until this event completes.

StopApplication requests termination of the app. The following class uses StopApplication to gracefully shut down an app when the class’s Shutdown method is called:

IApplicationLifetime interface

IApplicationLifetime allows for post-startup and shutdown activities. Three properties on the interface are cancellation tokens used to register Action methods that define startup and shutdown events.

Cancellation Token Triggered when…
ApplicationStarted The host has fully started.
ApplicationStopped The host is completing a graceful shutdown. All requests should be processed. Shutdown blocks until this event completes.
ApplicationStopping The host is performing a graceful shutdown. Requests may still be processing. Shutdown blocks until this event completes.

StopApplication requests termination of the app. The following class uses StopApplication to gracefully shut down an app when the class’s Shutdown method is called:

Scope validation

When ValidateScopes is set to true , the default service provider performs checks to verify that:

  • Scoped services aren’t directly or indirectly resolved from the root service provider.
  • Scoped services aren’t directly or indirectly injected into singletons.

The root service provider is created when BuildServiceProvider is called. The root service provider’s lifetime corresponds to the app/server’s lifetime when the provider starts with the app and is disposed when the app shuts down.

Scoped services are disposed by the container that created them. If a scoped service is created in the root container, the service’s lifetime is effectively promoted to singleton because it’s only disposed by the root container when app/server is shut down. Validating service scopes catches these situations when BuildServiceProvider is called.

To always validate scopes, including in the Production environment, configure the ServiceProviderOptions with UseDefaultServiceProvider on the host builder:

Оцените статью