Activities of "maliming"

Please enable the WebSocket feature in your Azure server.

hi

Let me check it on the azure website.

And share your logs.txt again. Thanks.

Answer

hi

You better download the source code of the Chat module to customize your new feature.

There are some services in the Signalr module.

hi

Please add the MyBlazorServerLookupApiRequestService to your blazor project and try again. The error logs will show the reason.

After the above test, you can add RemoteServices to your appsettins.json

  "RemoteServices": {
    "Default": {
      "BaseUrl": "https://your-real-url-dev.azurewebsites.net/"
    }
  },

Thanks.

using System;
using System.Globalization;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Volo.Abp;
using Volo.Abp.AspNetCore.Components.Web.Extensibility;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.MultiTenancy;

namespace Metro.Blazor;

[Dependency(ReplaceServices = true)]
public class MyBlazorServerLookupApiRequestService : ILookupApiRequestService, ITransientDependency
{
    public IHttpClientFactory HttpClientFactory { get; }
    public IRemoteServiceHttpClientAuthenticator HttpClientAuthenticator { get; }
    public IRemoteServiceConfigurationProvider RemoteServiceConfigurationProvider { get; }
    public ICurrentTenant CurrentTenant { get; }
    public IHttpContextAccessor HttpContextAccessor { get; }
    public NavigationManager NavigationManager { get; }

    public ILogger<MyBlazorServerLookupApiRequestService> Logger { get; }

    public MyBlazorServerLookupApiRequestService(IHttpClientFactory httpClientFactory,
        IRemoteServiceHttpClientAuthenticator httpClientAuthenticator,
        ICurrentTenant currentTenant,
        IHttpContextAccessor httpContextAccessor,
        NavigationManager navigationManager,
        IRemoteServiceConfigurationProvider remoteServiceConfigurationProvider,
        ILogger<MyBlazorServerLookupApiRequestService> logger)
    {
        HttpClientFactory = httpClientFactory;
        HttpClientAuthenticator = httpClientAuthenticator;
        CurrentTenant = currentTenant;
        HttpContextAccessor = httpContextAccessor;
        NavigationManager = navigationManager;
        RemoteServiceConfigurationProvider = remoteServiceConfigurationProvider;
        Logger = logger;
    }

    public async Task<string> SendAsync(string url)
    {
        Logger.LogError("SendAsync: {url}", url);

        var client = HttpClientFactory.CreateClient();
        var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);

        var uri = new Uri(url, UriKind.RelativeOrAbsolute);
        if (!uri.IsAbsoluteUri)
        {
            Logger.LogError("SendAsync: {url} is not absolute uri", url);

            var baseUrl = string.Empty;
            try
            {
                //Blazor tiered -- mode
                var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultAsync("Default");
                baseUrl = remoteServiceConfig.BaseUrl;

                Logger.LogError("Blazor tiered -- mode: {baseUrl}", baseUrl);

                client.BaseAddress = new Uri(baseUrl);
                AddHeaders(requestMessage);
                await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client,
                    requestMessage, new RemoteServiceConfiguration(baseUrl), string.Empty));
            }
            catch (AbpException e) // Blazor-Server mode.
            {
                Logger.LogError(e, "AbpException: {message}", e.Message);

                baseUrl = NavigationManager.BaseUri;

                Logger.LogError("AbpException Blazor tiered -- mode: {baseUrl}", baseUrl);

                client.BaseAddress = new Uri(baseUrl);
                foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers)
                {
                    requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
                }
            }
        }

        var response = await client.SendAsync(requestMessage);
        return await response.Content.ReadAsStringAsync();
    }

    protected virtual void AddHeaders(HttpRequestMessage requestMessage)
    {
        if (CurrentTenant.Id.HasValue)
        {
            requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString());
        }

        var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
        if (!currentCulture.IsNullOrEmpty())
        {
            requestMessage.Headers.AcceptLanguage.Add(new(currentCulture));
        }
    }
}

System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Volo.Abp.AspNetCore.Components.Server.Extensibility.BlazorServerLookupApiRequestService.SendAsync(String url)
   at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty`2.GetLookupItemsAsync(String filter)
   at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty`2.SearchFilterChangedAsync(String filter)
   at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty`2.OnAfterRenderAsync(Boolean firstRender)
   --- End of inner exception stack trace ---

hi

You also need to configure the Windows authentication.

Services.AddAuthentication

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth

hi

We will check this ASAP.

Many thanks.

hi

This is an RC version, it may have some problems, We will fix this.

Your question credits refunded. Thank you.

hi

We have a sample pull reqeust.

https://github.com/abpframework/abp/pull/8419

hi

Can you share a simple project to reproduce?

liming.ma@volosoft.com

Showing 6021 to 6030 of 11531 entries
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.1.0-preview. Updated on December 17, 2025, 07:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.