Open Closed

Blazor.host does not work #1332


User avatar
0
lataing created
  • ABP Framework version: v4.3.0
  • UI type: Blazor Module
  • Exception message and stack trace:
  • Steps to reproduce the issue: Run the BSDemo.IdentityServer and BSDemo.HttpApi.Host projects, and then run BSDemo.Blazor.Host, but it can't be started and stays on the loading page. Why?

6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    See https://github.com/abpio/abp-commercial-docs/pull/120

    Open <YourProjectName>BundleContributor.cs and replace context.Add("main.css"); to context.Add("main.css", true);

    Open appsettings.json and add the following:

    "AbpCli": {
        "Bundle": {
          "Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
          "Name": "global",
          "Parameters": {
            "LeptonTheme.Style": "Style6", /* Options: Style1, Style2... Style6 */
            "LeptonTheme.ChangeStyleDynamically": "true"
          }
        }
      }
    

    Then run abp bundle command in the blazor folder to update resource references.

  • User Avatar
    0
    lataing created

    @liangshiwei Hello, I didn't find the <YourProjectName>BundleContributor.cs file. Can you tell me the exact location?

    I created the module through suite, and did not make any changes, just run it directly. And when I run BSDemo.IdentityServer, I need to wait many minutes, which is much slower than running BSDemo.Web.Unified directly. It took 5.1 minutes to display the successful login

    By the way, for the module I created, I added a page to BSDemo.Blazor.Server project. How can I run blazor server to view it?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    It took 5.1 minutes to display the successful login

    Did you try again? I don't think it will be so slow

  • User Avatar
    0
    lataing created

    @liangshiwei

    I am using is the latest 4.3.1 module generated by the version of the suite, in Blazor. Host program and don't have the < YourProjectName > BundleContributor. Cs file.

    Did you try again? I don't think it will be so slow

    I have try again many times, in different computers are the same.

    I am using suite to create module project, how to run Blazor Server?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    For module project, try:

     public class MyProjectNameBlazorHostBundleContributor : IBundleContributor
    {
        public void AddScripts(BundleContext context)
        {
    
        }
    
        public void AddStyles(BundleContext context)
        {
            context.Add("main.css", true);
        }
    }
    

    Open appsettings.json and add the following:

    "AbpCli": {
        "Bundle": {
          "Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
          "Name": "global",
          "Parameters": {
            "LeptonTheme.Style": "Style1", /* Options: Style1, Style2... Style6 */
            "LeptonTheme.ChangeStyleDynamically": "true"
          }
        }
      }
    

    Then run abp bundle command in the Blazor.Host folder to update resource references.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09