kentico - 在干净的机器上启动 Kentico 13 CMS 时出错
问题描述
我正在尝试在新机器上从源代码运行 Kentico 13 CMS,但我得到了这个堆栈跟踪。当我从 Visual Studio 2019 使用 F5 启动该站点时,该站点不呈现登录提示。
我已将一个已知良好的数据库恢复到我的本地计算机并确认该站点已成功编译。
System.NullReferenceException: Object reference not set to an instance of an object.
at CMS.Membership.Internal.VirtualContextAuthenticationConfiguration.get_Audience()
at CMS.Membership.Internal.SecurityTokenManager`1..ctor(T tokenConfiguration, IJwtTokenService tokenService, IDateTimeNowService dateTimeNowService, IEventLogService eventLogService, IUserInfoProvider userInfoProvider)
at CMS.Membership.Internal.SecurityTokenManager`1..ctor(T tokenConfiguration)
at Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever..ctor()
at Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever..ctor()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, String authenticationScheme)
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context)
at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
解决方案
问题是不正确的数据库连接字符串。我需要确认数据库名称正确,用户名和密码正确,并且 SQL Server 实例的用户名/密码身份验证配置正确(不仅仅是 Windows 身份验证)。
推荐阅读
- rest - 我可以在同一台服务器上部署多个前端应用程序(网络/移动)和 1 个后端吗?
- postgis - pgAdmin 如何显示地理可视化?
- ios - 如何在objective-c上为这些textview设置自动高度
- json - 如何使用 Laravel Eloquent(POSTGRESQL)从 JSON 列中转换字段?
- python - 如何使用 for 循环制作字符串列表
- c# - Unity Serial.ReadLine() 问题
- spring - 在没有隐藏输入字段的 pojo 类中获取禁用的下拉值
- c# - 如何在视口上绘制 brep 实体的边界框?
- r - 对于 R 中的缺失值,如何获取列的子集并将其放入一个新列,其中包含 0 而不是 NA?
- java - 刽子手:当字母被猜到的时候,你是如何揭开它们的?