Activities of "zangwanyu"

yes

using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;

namespace TestApp;

public static class TestAppModuleExtensionConfigurator
{
    private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();

    public static void Configure()
    {
        OneTimeRunner.Run(() =>
        {
            ConfigureExistingProperties();
            ConfigureExtraProperties();
        });
    }

    private static void ConfigureExistingProperties()
    {
        /* You can change max lengths for properties of the
         * entities defined in the modules used by your application.
         *
         * Example: Change user and role name max lengths

           IdentityUserConsts.MaxNameLength = 99;
           IdentityRoleConsts.MaxNameLength = 99;

         * Notice: It is not suggested to change property lengths
         * unless you really need it. Go with the standard values wherever possible.
         *
         * If you are using EF Core, you will need to run the add-migration command after your changes.
         */
    }

    private static void ConfigureExtraProperties()
    {
        /* You can configure extra properties for the
         * entities defined in the modules used by your application.
         *
         * This class can be used to define these extra properties
         * with a high level, easy to use API.
         *
         * Example: Add a new property to the user entity of the identity module

           ObjectExtensionManager.Instance.Modules()
              .ConfigureIdentity(identity =>
              {
                  identity.ConfigureUser(user =>
                  {
                      user.AddOrUpdateProperty<string>( //property type: string
                          "SocialSecurityNumber", //property name
                          property =>
                          {
                              //validation rules
                              property.Attributes.Add(new RequiredAttribute());
                              property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});

                              //...other configurations for this property
                          }
                      );
                  });
              });

         * See the documentation for more:
         * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
         */

        ObjectExtensionManager.Instance.Modules()
              .ConfigureOpenIddict(openid =>
              {
                  openid.ConfigureApplication(app =>
                  {
                      app.AddOrUpdateProperty<string>("Description");                        
                  });
              });
    }
}

using Volo.Abp.ObjectExtending;
using Volo.Abp.OpenIddict.Applications;
using Volo.Abp.Threading;

namespace TestApp.EntityFrameworkCore;

public static class TestAppEfCoreEntityExtensionMappings
{
    private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();

    public static void Configure()
    {
        TestAppGlobalFeatureConfigurator.Configure();
        TestAppModuleExtensionConfigurator.Configure();

        OneTimeRunner.Run(() =>
        {
            /* You can configure extra properties for the
             * entities defined in the modules used by your application.
             *
             * This class can be used to map these extra properties to table fields in the database.
             *
             * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING.
             * USE TestAppModuleExtensionConfigurator CLASS (in the Domain.Shared project)
             * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES
             *
             * Example: Map a property to a table field:

                 ObjectExtensionManager.Instance
                     .MapEfCoreProperty<IdentityUser, string>(
                         "MyProperty",
                         (entityBuilder, propertyBuilder) =>
                         {
                             propertyBuilder.HasMaxLength(128);
                         }
                     );

             * See the documentation for more:
             * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities
             */

            ObjectExtensionManager.Instance
                .MapEfCoreProperty<OpenIddictApplication, string>("Description");
        });
    }
}

The test case code is as follows

using Shouldly;
using System.Threading.Tasks;
using Volo.Abp.OpenIddict.Applications;
using Volo.Abp.OpenIddict.Applications.Dtos;
using Xunit;

namespace TestApp.Samples;

/* This is just an example test class.
 * Normally, you don't test code of the modules you are using
 * (like IIdentityUserAppService here).
 * Only test your own application services.
 */
public class SampleAppServiceTests : TestAppApplicationTestBase
{
    private readonly IApplicationAppService _applicationAppService;

    public SampleAppServiceTests()
    {
        _applicationAppService = GetRequiredService<IApplicationAppService>();
    }

    [Fact]
    public async Task Should_Set_Description_Of_An_Application()
    {
        await WithUnitOfWorkAsync(async () =>
        {
            var app = new CreateApplicationInput()
            {
                ClientId = "test",
                DisplayName = "test"
            };

            app.ExtraProperties["Description"] = "Description1";

            await _applicationAppService.CreateAsync(app);
        });
        var list = await _applicationAppService.GetListAsync(new()
        {
            MaxResultCount = 1
        });

        // list.Items[0].ExtraProperties["Description"].ShouldBe("Description1");

        var app = await _applicationAppService.GetAsync(list.Items[0].Id);

        app.ExtraProperties["Description"].ShouldBe("Description1");

        
    }
}

The test failed as follows

 TestApp.Samples.SampleAppServiceTests.Should_Set_Description_Of_An_Application
   源: SampleAppServiceTests.cs 行 33
   持续时间: 4.3 秒

  消息: 
Shouldly.ShouldAssertException : app.ExtraProperties["Description"]
    should be
"Description1"
    but was
null

  堆栈跟踪: 
SampleAppServiceTests.Should_Set_Description_Of_An_Application() 行 56
ExceptionDispatchInfo.Throw()
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
TaskAwaiter.GetResult()
--- End of stack trace from previous location ---
ExceptionDispatchInfo.Throw()
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
TaskAwaiter.GetResult()
ExceptionDispatchInfo.Throw()
TaskAwaiter.ThrowForNonSuccess(Task task)
TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
TaskAwaiter.GetResult()

CustomApplicationManagment.razor

@using Volo.Abp.OpenIddict.Pro.Blazor.Pages @inherits ApplicationManagement

@{ base.BuildRenderTree(__builder); }

@if (HasUpdatePermission){

<DxPopup HeaderText="@L["Application"]" @bind-Visible="ApplicationPopup" Context="DxPopupContext" @ref="dxPopup"> <BodyContentTemplate>

    &lt;DxFormLayout&gt;
        
        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot; Context=&quot;item&quot;&gt;
            &lt;DxComboBox Data=&quot;organizationUnitDtoList&quot;
                        FilteringMode=&quot;DataGridFilteringMode.Contains&quot;
                        TextFieldName=&quot;DisplayName&quot;
                        ValueFieldName=&quot;Id&quot;
                        ClearButtonDisplayMode=&quot;DataEditorClearButtonDisplayMode.Auto&quot;
                        @bind-Value=&quot;@(EditingEntity.ExtraProperties[&quot;OrganizationUnitId&quot;])&quot;&gt;
                @L["OrganizationUnit"]
            &lt;/DxComboBox&gt;
        &lt;/DxFormLayoutItem&gt;
                    
        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot; Context=&quot;item&quot;&gt;
            &lt;DxCheckBox @bind-Checked=&quot;@(NeedVAuthority)&quot;&gt;
                @L["NeedVAuthority"]
            &lt;/DxCheckBox&gt;
        &lt;/DxFormLayoutItem&gt;

        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot;&gt;
            &lt;div class=&quot;right-align&quot;&gt;
                &lt;DxButton RenderStyle=&quot;ButtonRenderStyle.Primary&quot; Text=&quot;@L[&quot;Cancel&quot;]&quot; Click=&quot;()=&gt;ApplicationPopup=false" />
                &lt;DxButton RenderStyle=&quot;ButtonRenderStyle.Secondary&quot; Text=&quot;@L[&quot;Confirm&quot;]&quot; Click=&quot;ConfirmChange&quot; /&gt;
            &lt;/div&gt;
        &lt;/DxFormLayoutItem&gt;

    &lt;/DxFormLayout&gt;

&lt;/BodyContentTemplate&gt;

</DxPopup> }

CustomApplicationManagement.razor.cs

using DevExpress.Blazor;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions;
using Volo.Abp.BlazoriseUI;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectMapping;
using Volo.Abp.OpenIddict.Applications;
using Volo.Abp.OpenIddict.Applications.Dtos;
using Volo.Abp.OpenIddict.Pro.Blazor.Pages;

namespace MySoft.IdentityService.Blazor.Pages.IdentityServer
{

[ExposeServices(typeof(ApplicationManagement))]
[Dependency(ReplaceServices = true)]
public partial class CustomApplicationManagement
{
    [Inject] IOrganizationUnitAppService OrganizationUnitAppService { get; set; }

    bool ApplicationPopup;
    DxPopup dxPopup;

    List<OrganizationUnitWithDetailsDto> organizationUnitDtoList;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        var organizationUnitResult = await OrganizationUnitAppService.GetListAllAsync();
        organizationUnitDtoList = organizationUnitResult.Items.Where(u => u.ParentId == null).ToList();
    }

    protected async override Task OpenCreateModalAsync()
    {
        Scopes = (await ScopeAppService.GetAllScopesAsync()).ToDictionary(x => x.Name, x => false);
        CreateInput = new ApplicationModalView();
        CreateInput.ExtraProperties["NeedVAuthority"] = false;
        try
        {
            if (CreateValidationsRef != null)
            {
                await CreateValidationsRef.ClearAll();
            }

            await CheckCreatePolicyAsync();

            NewEntity = new CreateApplicationInput();

            // Mapper will not notify Blazor that binded values are changed
            // so we need to notify it manually by calling StateHasChanged
            await InvokeAsync(async () =>
            {
                StateHasChanged();
                if (CreateModal != null)
                {
                    await CreateModal.Show();
                }

            });
        }
        catch (Exception ex)
        {
            await HandleErrorAsync(ex);
        }
    }


    async Task OpenApplicationAsync(ApplicationDto entity)
    {
        if (dxPopup is not null)
        {
            ApplicationPopup = true;

            var entityDto = await AppService.GetAsync(entity.Id);

            EditingEntityId = entity.Id;
            EditingEntity = MapToEditingEntity(entityDto);
            EditingEntity.ExtraProperties["NeedVAuthority"] = false;
            EditingEntity.ExtraProperties["OrganizationUnitId"] = "";

            //EditingClientModelView = ObjectMapper.Map<UpdateClientDto, UpdateClientModelView>(EditingEntity);
            await InvokeAsync(StateHasChanged);

            await dxPopup.ShowAsync();
        }
    }



    protected async override Task OpenEditModalAsync(ApplicationDto entity)
    {
        await base.OpenEditModalAsync(entity);
        CreateInput.ClientUri = entity.ClientUri;
        CreateInput.LogoUri = entity.LogoUri;
        Scopes = (await ScopeAppService.GetAllScopesAsync()).ToDictionary(x => x.Name, x => EditingEntity.Scopes.Any(s => s == x.Name));
        await InvokeAsync(StateHasChanged);
    }

    protected override UpdateApplicationInput MapToEditingEntity(ApplicationDto entityDto)
    {
        UpdateInput = ObjectMapper.Map<ApplicationDto, ApplicationModalView>(entityDto);
        return base.MapToEditingEntity(entityDto); ;
    }

    protected override Task OnUpdatingEntityAsync()
    {
        UpdateInput.Scopes = Scopes.Where(x => x.Value).Select(x => x.Key).ToHashSet();
        UpdateInput.LogoUri = CreateInput.LogoUri;
        UpdateInput.ClientUri = CreateInput.ClientUri;
        EditingEntity = ObjectMapper.Map<ApplicationModalView, UpdateApplicationInput>(UpdateInput);
        return base.OnUpdatingEntityAsync();
    }

    protected override ValueTask SetEntityActionsAsync()
    {
        EntityActions
            .Get<ApplicationManagement>()
            .Add(
                new EntityAction
                {
                    Text = L["Application"],
                    Visible = (data) => HasUpdatePermission,
                    Clicked = async (data) => await OpenApplicationAsync(data.As<ApplicationDto>())
                });

        return base.SetEntityActionsAsync();
    }

    bool NeedVAuthority
    {
        get => (bool)EditingEntity.ExtraProperties["NeedVAuthority"];
        set => EditingEntity.ExtraProperties["NeedVAuthority"] = value;
    }
    async Task ConfirmChange()
    {
        await AppService.UpdateAsync(EditingEntityId, EditingEntity);
        ApplicationPopup = false;
    }
  }
}

the AppService.UpdateAsync method can't save extra properties values

var entityDto = await AppService.GetAsync(entity.Id); The GetAsync method also can't get extra properties values

@using Volo.Abp.OpenIddict.Pro.Blazor.Pages

@inherits ApplicationManagement

@{ base.BuildRenderTree(__builder); }

@if (HasUpdatePermission){

<DxPopup HeaderText="@L["Application"]" @bind-Visible="ApplicationPopup" Context="DxPopupContext" @ref="dxPopup"> <BodyContentTemplate>

    &lt;DxFormLayout&gt;
        
        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot; Context=&quot;item&quot;&gt;
            &lt;DxComboBox Data=&quot;organizationUnitDtoList&quot;
                        FilteringMode=&quot;DataGridFilteringMode.Contains&quot;
                        TextFieldName=&quot;DisplayName&quot;
                        ValueFieldName=&quot;Id&quot;
                        ClearButtonDisplayMode=&quot;DataEditorClearButtonDisplayMode.Auto&quot;
                        @bind-Value=&quot;@(EditingEntity.ExtraProperties[&quot;OrganizationUnitId&quot;])&quot;&gt;
                @L["OrganizationUnit"]
            &lt;/DxComboBox&gt;
        &lt;/DxFormLayoutItem&gt;
                    
        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot; Context=&quot;item&quot;&gt;
            &lt;DxCheckBox @bind-Checked=&quot;@(NeedVAuthority)&quot;&gt;
                @L["NeedVAuthority"]
            &lt;/DxCheckBox&gt;
        &lt;/DxFormLayoutItem&gt;

        &lt;DxFormLayoutItem ColSpanMd=&quot;12&quot;&gt;
            &lt;div class=&quot;right-align&quot;&gt;
                &lt;DxButton RenderStyle=&quot;ButtonRenderStyle.Primary&quot; Text=&quot;@L[&quot;Cancel&quot;]&quot; Click=&quot;()=&gt;ApplicationPopup=false" />

<DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="@L["Confirm"]" Click="ConfirmChange" />

            &lt;/div&gt;
        &lt;/DxFormLayoutItem&gt;

    &lt;/DxFormLayout&gt;

&lt;/BodyContentTemplate&gt;

</DxPopup> }

using DevExpress.Blazor; using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions; using Volo.Abp.BlazoriseUI; using Volo.Abp.DependencyInjection; using Volo.Abp.Identity; using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectMapping; using Volo.Abp.OpenIddict.Applications; using Volo.Abp.OpenIddict.Applications.Dtos; using Volo.Abp.OpenIddict.Pro.Blazor.Pages;

namespace aa.IdentityService.Blazor.Pages.IdentityServer {

[ExposeServices(typeof(ApplicationManagement))]

[Dependency(ReplaceServices = true)]

public partial class CustomApplicationManagement
{
    [Inject] IOrganizationUnitAppService OrganizationUnitAppService { get; set; }

    bool ApplicationPopup;
    DxPopup dxPopup;

    List&lt;OrganizationUnitWithDetailsDto&gt; organizationUnitDtoList;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        var organizationUnitResult = await OrganizationUnitAppService.GetListAllAsync();
        organizationUnitDtoList = organizationUnitResult.Items.Where(u => u.ParentId == null).ToList();
    }

    protected async override Task OpenCreateModalAsync()
    {
        Scopes = (await ScopeAppService.GetAllScopesAsync()).ToDictionary(x => x.Name, x => false);
        CreateInput = new ApplicationModalView();
        CreateInput.ExtraProperties["NeedVAuthority"] = false;
        try
        {
            if (CreateValidationsRef != null)
            {
                await CreateValidationsRef.ClearAll();
            }

            await CheckCreatePolicyAsync();

            NewEntity = new CreateApplicationInput();

            // Mapper will not notify Blazor that binded values are changed
            // so we need to notify it manually by calling StateHasChanged
            await InvokeAsync(async () =>
            {
                StateHasChanged();
                if (CreateModal != null)
                {
                    await CreateModal.Show();
                }

            });
        }
        catch (Exception ex)
        {
            await HandleErrorAsync(ex);
        }
    }


    async Task OpenApplicationAsync(ApplicationDto entity)
    {
        if (dxPopup is not null)
        {
            ApplicationPopup = true;

            var entityDto = await AppService.GetAsync(entity.Id);

            EditingEntityId = entity.Id;
            EditingEntity = MapToEditingEntity(entityDto);
            EditingEntity.ExtraProperties["NeedVAuthority"] = false;
            EditingEntity.ExtraProperties["OrganizationUnitId"] = "";

            //EditingClientModelView = ObjectMapper.Map&lt;UpdateClientDto, UpdateClientModelView&gt;(EditingEntity);
            await InvokeAsync(StateHasChanged);

            await dxPopup.ShowAsync();
        }
    }



    protected async override Task OpenEditModalAsync(ApplicationDto entity)
    {
        await base.OpenEditModalAsync(entity);
        CreateInput.ClientUri = entity.ClientUri;
        CreateInput.LogoUri = entity.LogoUri;
        Scopes = (await ScopeAppService.GetAllScopesAsync()).ToDictionary(x => x.Name, x => EditingEntity.Scopes.Any(s => s == x.Name));
        await InvokeAsync(StateHasChanged);
    }

    protected override UpdateApplicationInput MapToEditingEntity(ApplicationDto entityDto)
    {
        UpdateInput = ObjectMapper.Map&lt;ApplicationDto, ApplicationModalView&gt;(entityDto);
        return base.MapToEditingEntity(entityDto); ;
    }

    protected override Task OnUpdatingEntityAsync()
    {
        UpdateInput.Scopes = Scopes.Where(x => x.Value).Select(x => x.Key).ToHashSet();
        UpdateInput.LogoUri = CreateInput.LogoUri;
        UpdateInput.ClientUri = CreateInput.ClientUri;
        EditingEntity = ObjectMapper.Map&lt;ApplicationModalView, UpdateApplicationInput&gt;(UpdateInput);
        return base.OnUpdatingEntityAsync();
    }

    protected override ValueTask SetEntityActionsAsync()
    {
        EntityActions
            .Get&lt;ApplicationManagement&gt;()
            .Add(
                new EntityAction
                {
                    Text = L["Application"],
                    Visible = (data) => HasUpdatePermission,
                    Clicked = async (data) => await OpenApplicationAsync(data.As&lt;ApplicationDto&gt;())
                });

        return base.SetEntityActionsAsync();
    }

    bool NeedVAuthority
    {
        get => (bool)EditingEntity.ExtraProperties["NeedVAuthority"];
        set => EditingEntity.ExtraProperties["NeedVAuthority"] = value;
    }

async Task ConfirmChange()

{

await AppService.UpdateAsync(EditingEntityId, EditingEntity);

ApplicationPopup = false;

}

}

}

Invoke method ConfirmChange()

  • ABP Framework version: v6.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • [12:18:25 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application [12:18:25 DBG] Found in the cache: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application [12:18:25 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:OpenIddictPro.Application [12:18:25 DBG] Found in the cache: pn:R,pk:admin,n:OpenIddictPro.Application [12:18:25 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application [12:18:25 DBG] Found in the cache: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application [12:18:25 INF] Executing ObjectResult, writing value of type 'Volo.Abp.OpenIddict.Applications.Dtos.ApplicationDto'. [12:18:25 INF] Executed action Volo.Abp.OpenIddict.ApplicationController.GetAsync (Volo.Abp.OpenIddict.Pro.HttpApi) in 42.6238ms [12:18:25 INF] Executed endpoint 'Volo.Abp.OpenIddict.ApplicationController.GetAsync (Volo.Abp.OpenIddict.Pro.HttpApi)' [12:18:25 INF] Request finished HTTP/1.1 GET https://localhost:44388/api/openiddict/applications/496c821d-cf08-a729-a0d7-3a06ce526930?api-version=1.0 - 0 - 200 - application/json;+charset=utf-8 47.6289ms [12:18:34 INF] Request starting HTTP/1.1 PUT https://localhost:44388/api/openiddict/applications/496c821d-cf08-a729-a0d7-3a06ce526930?api-version=1.0 application/json;+charset=utf-8 653 [12:18:34 INF] Executing endpoint 'Volo.Abp.OpenIddict.ApplicationController.UpdateAsync (Volo.Abp.OpenIddict.Pro.HttpApi)' [12:18:34 INF] Route matched with {controller = "Applications", area = "openiddictpro", action = "Update"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.OpenIddict.Applications.Dtos.ApplicationDto] UpdateAsync(System.Guid, Volo.Abp.OpenIddict.Applications.Dtos.UpdateApplicationInput) on controller Volo.Abp.OpenIddict.ApplicationController (Volo.Abp.OpenIddict.Pro.HttpApi). [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application.Update [12:18:34 DBG] Found in the cache: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application.Update [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:OpenIddictPro.Application.Update [12:18:34 DBG] Found in the cache: pn:R,pk:admin,n:OpenIddictPro.Application.Update [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application.Update [12:18:34 DBG] Found in the cache: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application.Update [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application [12:18:34 DBG] Found in the cache: pn:U,pk:94c36bd4-906c-396b-19fa-3a06ce4ddc17,n:OpenIddictPro.Application [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:OpenIddictPro.Application [12:18:34 DBG] Found in the cache: pn:R,pk:admin,n:OpenIddictPro.Application [12:18:34 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application [12:18:34 DBG] Found in the cache: pn:C,pk:vSkysoft_BlazorServer,n:OpenIddictPro.Application [12:18:34 WRN] Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'. [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 INF] Executing ObjectResult, writing value of type 'Volo.Abp.OpenIddict.Applications.Dtos.ApplicationDto'. [12:18:34 INF] Executed action Volo.Abp.OpenIddict.ApplicationController.UpdateAsync (Volo.Abp.OpenIddict.Pro.HttpApi) in 402.5191ms [12:18:34 INF] Executed endpoint 'Volo.Abp.OpenIddict.ApplicationController.UpdateAsync (Volo.Abp.OpenIddict.Pro.HttpApi)' [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 DBG] Added 0 entity changes to the current audit log [12:18:34 INF] Request finished HTTP/1.1 PUT https://localhost:44388/api/openiddict/applications/496c821d-cf08-a729-a0d7-3a06ce526930?api-version=1.0 application/json;+charset=utf-8 653 - 200 - application/json;+charset=utf-8 670.3044ms
  • Steps to reproduce the issue:"

Hi.

Can you check this? : https://support.abp.io/QA/Questions/1999/Blazor-Server-App-deploy-on-IIS-Get-Authorization-Error-after-sigin

it works well. Thank you very much.

i tried it with swagger, it successed.

1, I create microservice temeplate with abp suite 2, Publish it with dotnet publish, and get Application below. 3, Set up docker and DbMigrator 4, Add authserver.pfx 5, Deploy it on iis 6, open blazor 7, login 8,select an item and some error exist 9, i checked log and get the code Volo.Authorization:010001

it happened when i deploy it on windows server 2019. but with the same step it worked well on my personal equipment.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.2.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  •  2022-04-19 15:12:21.035 +08:00 [INF] Request starting HTTP/1.1 GET [https://172.16.10.210:44388/api/identity-server/claim-types?api-version=1.0](https://172.16.10.210:44388/api/identity-server/claim-types?api-version=1.0) \- 0
    2022-04-19 15:12:21.045 +08:00 [INF] Request starting HTTP/1.1 GET [https://172.16.10.210:44388/api/identity-server/identity-resources?Sorting=&SkipCount=0&MaxResultCount=10&api-version=1.0](https://172.16.10.210:44388/api/identity-server/identity-resources?Sorting=&amp;SkipCount=0&amp;MaxResultCount=10&amp;api-version=1.0) \- 0
    2022-04-19 15:12:21.046 +08:00 [INF] Executing endpoint 'Volo.Abp.IdentityServer.IdentityServerClaimTypesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)'
    2022-04-19 15:12:21.049 +08:00 [INF] Executing endpoint 'Volo.Abp.IdentityServer.IdentityResourcesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)'
    2022-04-19 15:12:21.051 +08:00 [INF] Route matched with {controller = "ClaimTypes", area = "identityServer", action = "GetList"}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[Volo.Abp.IdentityServer.ClaimType.Dtos.IdentityClaimTypeDto]] GetListAsync() on controller Volo.Abp.IdentityServer.IdentityServerClaimTypesController (Volo.Abp.IdentityServer.HttpApi).
    2022-04-19 15:12:21.058 +08:00 [INF] Route matched with {controller = "IdentityResources", area = "identityServer", action = "GetList"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Volo.Abp.IdentityServer.IdentityResource.Dtos.IdentityResourceWithDetailsDto]] GetListAsync(Volo.Abp.IdentityServer.IdentityResource.Dtos.GetIdentityResourceListInput) on controller Volo.Abp.IdentityServer.IdentityResourcesController (Volo.Abp.IdentityServer.HttpApi).
    2022-04-19 15:12:21.173 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: IdentityServer.IdentityResource
    2022-04-19 15:12:21.187 +08:00 [WRN] ---------- RemoteServiceErrorInfo ----------
    {
    "code": "Volo.Authorization:010001",
    "message": "授权失败! 提供的策略尚未授予.",
    "details": null,
    "data": {},
    "validationErrors": null
    }
    Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
    at Microsoft.AspNetCore.Authorization.AbpAuthorizationServiceExtensions.CheckAsync(IAuthorizationService authorizationService, AuthorizationPolicy policy)
    at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
    at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
    at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
    at Castle\.DynamicProxy\.AsyncInterceptorBase\.ProceedAsynchronous\[TResult\]\(IInvocation invocation\, IInvocationProceedInfo proceedInfo\)
    at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() 
    at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) 
    at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) 
    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) 
    at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) 
    at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
    at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
    at lambda\_method1824(Closure , Object )    
    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
    at Microsoft\.AspNetCore\.Mvc\.Infrastructure\.ControllerActionInvoker\.g\_\_Awaited\|12\_0\(ControllerActionInvoker invoker\, ValueTask`1 actionResultValueTask) 
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- 
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
    2022-04-19 15:12:21.187 +08:00 [WRN] Code:Volo.Authorization:010001 
    2022-04-19 15:12:21.188 +08:00 [INF] AuthenticationScheme: Bearer was challenged. 
    2022-04-19 15:12:21.188 +08:00 [INF] Executed action Volo.Abp.IdentityServer.IdentityResourcesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi) in 130.1956ms 
    2022-04-19 15:12:21.188 +08:00 [INF] Executed endpoint 'Volo.Abp.IdentityServer.IdentityResourcesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)' 
    2022-04-19 15:12:21.333 +08:00 [INF] Request finished HTTP/1.1 GET https://172.16.10.210:44388/api/identity-server/identity-resources?Sorting=&SkipCount=0&MaxResultCount=10&api-version=1.0 - 0 - 401 - - 287.8985ms        
    2022-04-19 15:12:21.755 +08:00 [INF] Executing ObjectResult, writing value of type 'System.Collections.Generic.List`1[[Volo.Abp.IdentityServer.ClaimType.Dtos.IdentityClaimTypeDto, Volo.Abp.IdentityServer.Application.Contracts, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2022-04-19 15:12:21.766 +08:00 [INF] Executed action Volo.Abp.IdentityServer.IdentityServerClaimTypesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi) in 714.2628ms
    2022-04-19 15:12:21.767 +08:00 [INF] Executed endpoint 'Volo.Abp.IdentityServer.IdentityServerClaimTypesController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)'
    2022-04-19 15:12:21.769 +08:00 [INF] Request finished HTTP/1.1 GET [https://172.16.10.210:44388/api/identity-server/claim-types?api-version=1.0](https://172.16.10.210:44388/api/identity-server/claim-types?api-version=1.0) \- 0 \- 200 \- application/json;\+charset=utf\-8 734\.3673ms
    
    
  • Steps to reproduce the issue:"

I build a MicroService Templete and deploy it on "windows server 2019", i get the error in HttpApi.Host logs when i call related page.

But it worked well on my "windows 10" equipment.

Is there any config i ignore or environment difference?

  • ABP Framework version: v5.1.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:

2022-03-23 10:55:12.056 +08:00 [ERR] Connection ID "18374686519131635749", Request ID "40000026-0009-ff00-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://localhost:44313/.well-known/openid-configuration'. ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://localhost:44313/.well-known/openid-configuration'. ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception) at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm) at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request) at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync() at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.AuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme) at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

  • Steps to reproduce the issue:"

I use ABP Application Template(blazor server ui) as an authorization server, and build a Blazor WebAssembly application as third-party Client.

In the client, i config it according to https://docs.microsoft.com/zh-cn/aspnet/core/blazor/security/webassembly/standalone-with-authentication-library?view=aspnetcore-3.1&tabs=visual-studio, and add it into abp client.

It works well when I test it in VS.

But when I publish it on IIS and try to login, after enter account, password and click Login, the page below exist.

The log error is above.

I tried to use self-signed certificate, but it doesn’t work.

Showing 1 to 9 of 9 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11