Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rubenc57 opened this issue May 16, 2024 · 5 comments
Open
Labels
Needs: Triage 🔍 Label added to new issues which need Triage

Comments

@rubenc57
Copy link

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.

@dotnet-policy-service dotnet-policy-service bot added the Needs: Triage 🔍 Label added to new issues which need Triage label May 16, 2024
@rubenc57
Copy link
Author

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:

  • The setup works fine in a .NET Framework application but not in an ASP.NET Core (Razor Pages) application.
  • No error messages or logs indicating the root cause of the blank screen.

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
Copy link
Author

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:

  • The blank screen appears only when the above snippet is included.
  • Removing the snippet resolves the issue, and the HomeController index page displays correctly.

Project Details:

  • Framework: .NET Core
  • App Type: ASP.NET Core Web App (Model-View-Controller) and previously ASP.NET Core (Razor Pages)
  • Proxy: Microsoft Reverse Proxy

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
Copy link
Author

rubenc57 commented May 21, 2024

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:

  • 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:

  • The issue persists when the SystemWebAdapters configuration is included.
  • Removing the snippet resolves the issue, and the HomeController index page displays correctly.

Project Details:

  • Framework: .NET Core (following an upgrade from .NET Framework)
  • Proxy: Microsoft Reverse Proxy

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
Copy link
Author

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

@rubenc57
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Label added to new issues which need Triage
Projects
None yet
Development

No branches or pull requests

1 participant