dotnet / systemweb-adapters

MIT License
332 stars 58 forks source link

Help Needed: Blank Screen Issue with Microsoft Reverse Proxy in .NET Core #501

Open rubenc57 opened 2 months ago

rubenc57 commented 2 months ago

Hi everyone,

I'm currently working on incrementally updating my WebForms website using the Microsoft Reverse Proxy in a new .NET Core application. I've added the necessary services in program.cs, but when I run the app, I encounter a blank screen. Here is the relevant code snippet from my program.cs:

builder.Services.AddSystemWebAdapters() .AddJsonSessionSerializer(options => { options.RegisterKey("MachineName"); options.RegisterKey("SessionStartTime"); //options.RegisterKey("DemoItem"); }) .AddRemoteAppClient(options => { options.RemoteAppUrl = new(builder.Configuration["ProxyTo"]); options.ApiKey = builder.Configuration["RemoteAppApiKey"]; }) .AddSessionClient(); If I remove the builder.Services.AddSystemWebAdapters() snippet, index page is shown again

I've double-checked my configuration settings and everything seems to be in place. However, when I execute the app, all I get is a blank screen without any error messages or logs that indicate what might be going wrong.

Details: Framework: .NET Core Proxy: Microsoft Reverse Proxy Configuration: ProxyTo and RemoteAppApiKey are set in the configuration file. Troubleshooting Steps Taken: Verified configuration settings in appsettings.json. Checked for any runtime errors or logs – none found. Uncommented the RegisterKey("DemoItem") line – no change. Has anyone experienced a similar issue or have any ideas on how to resolve this? Any help or suggestions would be greatly appreciated!

I'm following this tutorial: https://youtu.be/_XG3EYRcgY8?si=2ARtMWNSIcIDEvCO

Thanks in advance.

rubenc57 commented 2 months ago

Follow-Up: Blank Screen Issue with Microsoft Reverse Proxy in .NET Core

Hi everyone,

I'm following up on my previous post regarding the blank screen issue I'm encountering with the Microsoft Reverse Proxy in a .NET Core application.

New Findings:

I created a new ASP.NET Web Application (.NET Framework) and implemented the Microsoft Reverse Proxy for incremental updates. Here’s what I did:

  1. Implemented the reverse proxy as per the documentation.
  2. Followed the tutorial "Using System.Web Adapters to Share Session State in ASP.NET Upgrade Scenarios" from this YouTube video.

Everything worked perfectly fine in the .NET Framework web application.

Steps Taken:

  1. Created ASP.NET Core Web App (Razor Pages):

    • I then created a new ASP.NET Core web app using Razor Pages.
    • I copied over the wwwroot and Pages folders from my ASP.NET Web Application (.NET Framework).
  2. Encountered the Issue:

    • When running the ASP.NET Core web app, I encounter a blank screen again.

Configuration Snippet:

Here’s the code snippet from my program.cs for reference:

builder.Services.AddSystemWebAdapters()
    .AddJsonSessionSerializer(options =>
    {
        options.RegisterKey<string>("MachineName");
        options.RegisterKey<DateTime>("SessionStartTime");
        //options.RegisterKey<SessionDemoModel>("DemoItem");
    })
    .AddRemoteAppClient(options =>
    {
        options.RemoteAppUrl = new(builder.Configuration["ProxyTo"]);
        options.ApiKey = builder.Configuration["RemoteAppApiKey"];
    })
    .AddSessionClient();

Observations:

Request for Assistance:

What could be causing the blank screen in the ASP.NET Core (Razor Pages) application? Has anyone experienced similar issues or have any insights into what might be going wrong?

Thank you for your assistance!

rubenc57 commented 1 month ago

Follow-Up: Persistent Blank Screen Issue with Microsoft Reverse Proxy in .NET Core

Hi everyone,

I’m following up on my previous posts regarding the blank screen issue when using the Microsoft Reverse Proxy in a .NET Core application. I’ve conducted further testing and have new observations to share.

Latest Attempt:

I decided to recreate everything using an ASP.NET Core Web App (Model-View-Controller) project. Unfortunately, I encountered the same blank screen issue.

Troubleshooting Steps:

  1. Removed the SystemWebAdapters Configuration:
    • When I remove the following snippet from program.cs, the HomeController index page loads correctly:
builder.Services.AddSystemWebAdapters()
    .AddJsonSessionSerializer(options =>
    {
        options.RegisterKey<string>("MachineName");
        options.RegisterKey<DateTime>("SessionStartTime");
        //options.RegisterKey<SessionDemoModel>("DemoItem");
    })
    .AddRemoteAppClient(options =>
    {
        options.RemoteAppUrl = new(builder.Configuration["ProxyTo"]);
        options.ApiKey = builder.Configuration["RemoteAppApiKey"];
    })
    .AddSessionClient();

Observations:

Project Details:

Request for Assistance:

Given that the issue persists across both Razor Pages and MVC projects when the SystemWebAdapters configuration is included, what could be the underlying cause? Are there specific settings or dependencies I might be missing?

Thank you for your continued help and suggestions!

rubenc57 commented 1 month ago

Follow-Up: Persistent Blank Screen Issue with Microsoft Reverse Proxy in .NET Core

I’m following up with additional insights on the blank screen issue I'm experiencing when using the Microsoft Reverse Proxy in a .NET Core application. Here’s what I did recently:

Latest Steps Taken:

  1. Created a New ASP.NET Web Application (.NET Framework):

    • I implemented the Microsoft Reverse Proxy for incremental updates, and it worked perfectly fine.
  2. Upgraded to ASP.NET Core:

    • I created a new ASP.NET Core Web Application (WebApplication6Core) as part of the upgrade process.
  3. Added a Folder and Controller:

    • I added a new folder, "Controllers" and a HomeController to this ASP.NET Core project.
    • This setup leads to the same blank screen issue.

Troubleshooting Steps:

builder.Services.AddSystemWebAdapters()
    .AddJsonSessionSerializer(options =>
    {
        options.RegisterKey<string>("MachineName");
        options.RegisterKey<DateTime>("SessionStartTime");
        //options.RegisterKey<SessionDemoModel>("DemoItem");
    })
    .AddRemoteAppClient(options =>
    {
        options.RemoteAppUrl = new(builder.Configuration["ProxyTo"]);
        options.ApiKey = builder.Configuration["RemoteAppApiKey"];
    })
    .AddSessionClient();

Observations:

Project Details:

Request for Assistance:

Given that the issue persists across the upgraded project when the SystemWebAdapters configuration is included, what could be causing this? Are there specific settings or dependencies I might be missing? I'm ready to include the project files if needed.

I'm sure the snippet is wrong...

Can someone help?

rubenc57 commented 1 month ago

if i add this in program.cs, it does not work builder.Services.AddSystemWebAdapters(); if I remove it, it works

rubenc57 commented 1 month ago

Meanwhile I'm using cookies to share data between the two apps 🤷‍♂️