Reputation: 1
I have an application built for windows and osx using ElectronNET and Blazor. Everything works fine on my windows machines but when I attempt to run the software on osx I got a blank white screen and the debug terminal says
"(node:14402) electron: Failed to load URL: http://localhost:8002/ with error: ERR_CONNECTION_REFUSED"
If I go to the menubar and click refresh the page loads and I get another message
"warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect."
I've tried cleaning my project, deleting the bin and obj folders, deleting the .vs folder, turning off firewall, configuring chrome, checking proxies, etc. nothing has worked so far and I'm not sure what to do anymore.
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using ElectronNET.API;
using ElectronNET.API.Entities;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });
builder.Services.AddDevExpressBlazor();
builder.Services.AddElectron();
builder.Services.Configure<DevExpress.Blazor.Configuration.GlobalOptions>(options => {
options.BootstrapVersion = DevExpress.Blazor.BootstrapVersion.v5;
});
builder.WebHost.UseWebRoot("wwwroot");
builder.WebHost.UseStaticWebAssets();
builder.WebHost.UseElectron(args);
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
var browserWindowOptions = new BrowserWindowOptions
{
AutoHideMenuBar = true
};
var browserWindow = await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
Upvotes: 0
Views: 402
Reputation: 1
changing this line
var browserWindow = await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
to this
async void CreateWindow()
{
var window = await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);
window.OnClosed += () => {
Electron.App.Quit();
};
}
fixed the issue
Upvotes: 0