【问题标题】:Electron NET doesn't run in Production mode in win10Electron NET 在 win10 中无法在生产模式下运行
【发布时间】:2021-05-23 11:42:17
【问题描述】:

我正在使用带有 Electron NET 的 asp.net core razor pages 在调试 Electron 应用程序时,当我使用电子 cli 构建它时,它的运行没有错误

>electronize build /target win

并运行它安装的设置,应用程序出现在任务管理器上,但没有窗口 我的代码:在启动中

  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseMigrationsEndPoint();
        }
        else
        {
            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();

        app.UseAuthentication();
        app.UseAuthorization();
        app.UseEndpoints(endpoints =>
        {

            endpoints.MapRazorPages();
        });
        if (HybridSupport.IsElectronActive)
        {
            
            CreateWindow();
        }
    }
    private async void CreateWindow()
    {
        var window = await Electron.WindowManager.CreateWindowAsync();
        
        window.OnClosed += () => {
            Electron.App.Quit();
        };
    }

在程序中:

 public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseElectron(args);

                webBuilder.UseStartup<Startup>();
            });

【问题讨论】:

    标签: electron electron-builder electron.net


    【解决方案1】:

    当我使用 mvc 项目而不是剃须刀页面时,它可以正常工作

    【讨论】:

      猜你喜欢
      • 2020-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 2022-08-19
      • 1970-01-01
      • 2020-10-22
      • 1970-01-01
      相关资源
      最近更新 更多