重新初始化Orchard Core数据库

时间:2018-12-18 15:00:25

标签: orchardcms

到目前为止,为了重新初始化Orchard CMS,我删除了app_data / Site文件夹,这导致Orchard显示了设置页面。出于某种原因,它不再起作用,并且出现以下错误

System.NullReferenceException: Object reference not set to an instance of an object.
   at YesSql.QueryExtensions.Query[T](ISession session) in C:\projects\yessql-un1yf\src\YesSql.Abstractions\QueryExtensions.cs:line 11
   at OrchardCore.Settings.Services.SiteService.GetSiteSettingsAsync() in C:\projects\orchard2\src\OrchardCore.Modules\OrchardCore.Settings\Services\SiteService.cs:line 48
   at OrchardCore.DisplayManagement.Razor.SiteViewResultFilter.OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next) in C:\projects\orchard2\src\OrchardCore\OrchardCore.DisplayManagement\Razor\SiteViewResultFilter.cs:line 24
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.Extensions.DependencyInjection.CommitSessionMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchard2\src\OrchardCore\OrchardCore.Data\OrchardCoreBuilderExtensions.cs:line 155
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchard2\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 76
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchard2\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 100
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)

如果我只是删除settings.txt文件,也会发生这种情况

我的问题是迫使Orchard显示设置页面的最佳方法是什么。我正在运行1.0.0-beta3-70136

1 个答案:

答案 0 :(得分:0)

该错误是由我注入Orchard ISiteService类引起的。不知道为什么,但是我删除了DI,错误消失了