0
votes

Up until now in order to re-initialise the Orchard CMS I was removing the app_data/Site folder which resulted in Orchard showing the setup page. For some reason this is no longer working and I get the following error

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)

This also happens if I simply remove the settings.txt file

My question is what is the best way to force Orchard to show the setup page. I'm running 1.0.0-beta3-70136

1

1 Answers

0
votes

The error was caused by my injection of the Orchard ISiteService class. Not sure why but I removed the DI and the error went away