Hi again,
There’s been some changes to SS8/NET8, because my code that was running isn’t anymore. Well most of it is.
This part crashes:
I’m getting this message:
No service for type ‘Microsoft.AspNetCore.Http.IHttpContextAccessor’ has been registered.
What I’m doing at the line that crashes is:
return new HttpResult(cell, HttpStatusCode.Created)
{
Location = new CellDetail { Id = savedCell._id }.ToAbsoluteUri(),
Headers = {
{ "X-Location", new CellDetail { Id = savedCell._id }.ToAbsoluteUri() },
}
};
I guess a workaround is to change the Api, and just return a DTO, but I want to let you know that this has been working fine until today.
My project was converted from a SS6/NET7 project. All I did was to change the version numbers in the project files, as my project was already built with these kind of Configure.xxx files:
[assembly: HostingStartup(typeof(Mindcell.ConfigureAuth))]
Is there a “upgrade guide” or something that I should’ve followed?
The full stack-trace below:
[CellCreateOrUpdate: 26.01.2024 20:11:56]:
[REQUEST: {title:test cell2,description:"",work:3,stealFromParentsWork:True,progress:0,completed:False,discardRemaining:False,parentId:610181793761}]
System.InvalidOperationException: No service for type 'Microsoft.AspNetCore.Http.IHttpContextAccessor' has been registered.
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at ServiceStack.AppHostBase.TryGetCurrentRequest() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/AppHostBase.NetCore.cs:line 532
at ServiceStack.HostContext.TryGetCurrentRequest() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/HostContext.cs:line 330
at ServiceStack.HttpExtensions.ToAbsoluteUri(String relativeUrl, IRequest req) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/HttpExtensions.cs:line 44
at ServiceStack.HttpExtensions.ToAbsoluteUri(IReturn requestDto, String httpMethod, String formatFallbackToPredefinedRoute) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/HttpExtensions.cs:line 16
at Mindcell.ServiceInterface.CellServices.Post(CellCreateOrUpdate req) in C:\Programming\MindCell\mindcell23\Mindcell\api\Mindcell.ServiceInterface\CellServices.cs:line 77
at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/ServiceRunner.cs:line 149