Closed
Description
I'm using version 1.4 of this libraries.
on the global.asax I have this configuration:
SystemWebAdapterConfiguration.AddSystemWebAdapters(this)
.AddProxySupport(options => options.UseForwardedHeaders = true)
.AddJsonSessionSerializer(options =>
{
// Register session item names/types that will be read or written
options.RegisterKey<string>("Test-Value");
})
.AddRemoteAppServer(options =>
{
options.ApiKey = builder.Configuration["RemoteAppApiKey"];
}).AddSessionServer();
in Programm.cs
builder.Services.AddSystemWebAdapters()
.AddJsonSessionSerializer(options =>
{
// Serialization/deserialization requires each session key to be registered to a type
options.RegisterKey<string>("Test-Value");
})
.AddRemoteAppClient(options =>
{
options.RemoteAppUrl = new (builder.Configuration["ProxyTo"]);
options.ApiKey = builder.Configuration["RemoteAppApiKey"];
})
.AddSessionClient();
in controller (migrated in .net 8):
namespace testsession.Controllers
{
[Session]
public class SessionController : Controller
{
// GET: Session
public ActionResult Index()
{
var sess = System.Web.HttpContext.Current?.Session?["Test-Value"];
return View();
}
}
}
when I try to access the page it gives me this error:
HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Microsoft.AspNetCore.SystemWebAdapters.SessionState.RemoteSession.RemoteAppSessionStateManager.GetSessionDataAsync(string sessionId, bool readOnly, HttpContext callingContext, CancellationToken token)
Microsoft.AspNetCore.SystemWebAdapters.SessionState.RemoteSession.RemoteAppSessionStateManager.CreateAsync(HttpContext context, SessionAttribute metadata)
Microsoft.AspNetCore.SystemWebAdapters.SessionMiddleware.ManageStateAsync(HttpContext context, SessionAttribute metadata)
Microsoft.AspNetCore.SystemWebAdapters.PreBufferRequestStreamMiddleware.InvokeAsync(HttpContext context)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
how can I solve it?