Open Closed

Blazor WebApp Error on Ubuntu/Nginx Production #7665


User avatar
0
hanntd created

Hi, I dev Blazor WebApp with v8.2 running well on development environment but when publishing to production running on nginx/ubuntu the error happened after clicked on Login button at Login Form. The home page still show ok, then click on Login --> Login Form show ok, too--> Enter user name and pwd, click login --> error happened: Link of Log file: https://drive.google.com/file/d/1bjEl2FtGVu6hYSlQj26jD9QznCYKLo7g/view?usp=sharing

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    1.

    Please share the code of HQSOFT.eBiz.CoreBackend.AuditLogging.ExtendedAuditLogContributor class. there is a NullReferenceException

    2.

    Please set log level to Debug and re-share the logs.

    public class Program
    {
        public async static Task<int> Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
                .Enrich.FromLogContext()
                .WriteTo.Async(c => c.File("Logs/logs.txt"))
                .WriteTo.Async(c => c.Console())
                .CreateLogger();
    

    Thanks.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    hanntd created

    Here are of AuditLogContributor (I have fixed issue of NullReferenceException) and new log file:

    public class ExtendedAuditLogContributor : AuditLogContributor
    	{
    		public override void PreContribute(AuditLogContributionContext context)
    		{
    			var urlProp = context.AuditInfo.GetProperty("ScreenUrl");
    			var url = context.GetHttpContext().Request.Headers["screen-url"].ToString();
    			if (urlProp != null && string.IsNullOrEmpty(url))
    				context.AuditInfo.SetProperty("ScreenUrl", url);
    		}
    
    		public override void PostContribute(AuditLogContributionContext context)
    		{
    			var currentUser = context.ServiceProvider.GetRequiredService<ICurrentUser>();
    
    			foreach (var change in context.AuditInfo.EntityChanges)
    			{
    				var screenUrl = context.GetHttpContext().Request.Headers["screen-url"].ToString();
    				if (string.IsNullOrEmpty(screenUrl))
    					continue;
    				var uri = new Uri(screenUrl);
    				var path = uri.PathAndQuery;
    				var lastIndex = path.LastIndexOf('/');
    
    				var urlDoc = path.Substring(0, lastIndex + 1);
    				var docId = path.Substring(lastIndex + 1);
    
    				change.SetProperty("ScreenUrl", urlDoc);
    				change.SetProperty("DocId", docId);
    
    				change.SetProperty("UserId", currentUser.Id);
    			}
    		}
    	}
    

    https://drive.google.com/file/d/1kQpTa7rcIv3-MR4S6f5yUyfJ-bslmhGH/view?usp=sharing

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your PreContribute has a problem please debug your app to see which variable is null

    [WRN] Object reference not set to an instance of an object.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at HQSOFT.eBiz.CoreBackend.AuditLogging.ExtendedAuditLogContributor.PreContribute(AuditLogContributionContext context)
       at Volo.Abp.Auditing.AuditingHelper.ExecutePreContributors(AuditLogInfo auditLogInfo)
    
    public override void PreContribute(AuditLogContributionContext context)
    {
        var urlProp = context.AuditInfo.GetProperty("ScreenUrl");
        var url = context.GetHttpContext().Request.Headers["screen-url"].ToString();
        if (urlProp != null && string.IsNullOrEmpty(url))
        context.AuditInfo.SetProperty("ScreenUrl", url);
    }
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Do you have the configuration below in your Blazor client project?

    https://abp.io/docs/latest/modules/chat#blazor-webassembly-ui

    
    Configure<ChatBlazorWebAssemblyOptions>(options =>
    {
        options.SignalrUrl = builder.Configuration["RemoteServices:Chat:BaseUrl"];
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    hanntd created

    Hi, Because Chat module is currently not working if injected in Blazor Client as I reported in another ticket so I didn't injected but i forgot to remove in others project. I have remove Chat module in others projects and now my application running ok on production. Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. I will check your other ticket. The current ticket has been refunded.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    hanntd created

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.