我正在尝试在 Windows 服务器 IIS 上托管我的 .NET 核心项目 (nopCommerce 4.7),已在那里发布文件但出现错误:
Category: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
EventId: 2
SpanId: 15ef495fc1e97c42
TraceId: 9f6ade836602c22e139ae05a6b6f46d8
ParentId: 0000000000000000
RequestId: 80000192-0000-b300-b63f-84710c7967bb
RequestPath: /
Connection ID "12898309334399713681", Request ID "80000192-0000-b300-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Exception:
System.ArgumentException: Options.ClientId must be provided (Parameter 'ClientId')
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.Validate()
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.Validate(String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationBuilder.<>c__DisplayClass4_0`2.<AddSchemeHelper>b__1(TOptions o)
at Microsoft.Extensions.Options.ValidateOptions`1.Validate(String name, TOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd[TArg](String name, Func3 createOptions, TArg factoryArgument)
at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.InitializeAsync(AuthenticationScheme scheme, HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, String authenticationScheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
当您在 IIS 上托管网站时,请删除
MultiFactorAuth.GoogleAuthenticator
和 ExternalAuth.Facebook
(如果不使用)。