Activities of "pvala"

Sure, here it is.

If you see here in the following form, you'd see 2 input fields i.e., Name and Gender, the details of which are being fetched from the database from an API endpoint. And those fields will be generated dynamically on run time.

Now, once I put all the details, and click on Register, those 2 fields will be disappeared.

Here is my code as well :

Register.cshtml.cs file :

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using G1.health.ClinicService.ClinicSetup;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Owl.reCAPTCHA;
using survey.FormsService.Forms;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Public.Web.Pages.Account;
using Volo.Abp.Account.Public.Web.Security.Recaptcha;
using Volo.Abp.Account.Settings;
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Security.Claims;
using Volo.Abp.Settings;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
using Volo.Forms;
using Volo.Forms.Questions;
using IdentityUser = Volo.Abp.Identity.IdentityUser;

namespace G1.health.AuthServer.Pages.Account;

public class RegisterModel : Web.Pages.Account.AccountPageModel
{
    public IAbpTenantAppService AbpTenantAppService { get; set; }

    public IFormsAppService FormsAppService { get; set; }

    public IUsersAppService UsersAppService { get; set; }

    private readonly IUnitOfWorkManager UnitOfWorkManager;

    public RegisterModel(IAbpTenantAppService abpTenantAppService, IFormsAppService formsAppService, IUsersAppService usersAppService, IUnitOfWorkManager unitOfWorkManager)
    {
        AbpTenantAppService = abpTenantAppService;
        FormsAppService = formsAppService;
        UsersAppService = usersAppService;
        UnitOfWorkManager = unitOfWorkManager;
    }

    [BindProperty(SupportsGet = true)]
    public string? ReturnUrl { get; set; }

    [BindProperty(SupportsGet = true)]
    public string? ReturnUrlHash { get; set; }

    [BindProperty(SupportsGet = true)]
    public Guid TenantId { get; set; }

    [BindProperty]
    public PostInput Input { get; set; }

    [BindProperty]
    public List<Field> Fields { get; set; }

    [BindProperty]
    public List<QuestionDto> QuestionDtos { get; set; }

    private async Task CreateExtraFields()
    {
        var tenant = await AbpTenantAppService.FindTenantByIdAsync(TenantId);

        if (tenant.TenantId != null)
        {
            var form = await FormsAppService.GetRegistrationFormAsync(TenantId);
            QuestionDtos = form.Questions;
        }

        Fields = new List<Field>();

        foreach (var item in QuestionDtos)
        {
            var choices = new List<SelectListItem>();

            foreach (var choice in item.Choices)
            {
                choices.Add(new SelectListItem()
                {
                    Text = choice.Value,
                    Value = choice.Value
                });
            }

            Field field = new Field
            {
                Index = item.Index,
                Title = item.Title,
                IsRequired = item.IsRequired,
                HasOtherOption = item.HasOtherOption,
                QuestionType = item.QuestionType,
                Answer = null,
                Choices = choices,
                Answers = null
            };
            Fields.Add(field);
        }
    }

    [BindProperty(SupportsGet = true)]
    public bool IsExternalLogin { get; set; }

    public bool LocalLoginDisabled { get; set; }

    public bool UseCaptcha { get; set; }

    public virtual async Task<IActionResult> OnGetAsync()
    {

        //await ValidateForm();

        var localLoginResult = await CheckLocalLoginAsync();
        if (localLoginResult != null)
        {
            LocalLoginDisabled = true;
            return localLoginResult;
        }

        await CheckSelfRegistrationAsync();
        await TrySetEmailAsync();
        await SetUseCaptchaAsync();

        await CreateExtraFields();

        return Page();
    }

    [UnitOfWork] //TODO: Will be removed when we implement action filter
    public virtual async Task<IActionResult> OnPostAsync()
    {
        try
        {
            await CheckSelfRegistrationAsync();
            await SetUseCaptchaAsync();

            IdentityUser user;
            if (IsExternalLogin)
            {
                var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
                if (externalLoginInfo == null)
                {
                    Logger.LogWarning("External login info is not available");
                    return RedirectToPage("./Login");
                }

                user = await RegisterExternalUserAsync(externalLoginInfo, Input.EmailAddress);
            }
            else
            {
                var localLoginResult = await CheckLocalLoginAsync();
                if (localLoginResult != null)
                {
                    LocalLoginDisabled = true;
                    return localLoginResult;
                }

                user = await RegisterLocalUserAsync();
            }

            if (await SettingProvider.IsTrueAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail) && !user.EmailConfirmed ||
                await SettingProvider.IsTrueAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber) && !user.PhoneNumberConfirmed)
            {
                await StoreConfirmUser(user);

                return RedirectToPage("./ConfirmUser", new
                {
                    returnUrl = ReturnUrl,
                    returnUrlHash = ReturnUrlHash
                });
            }

            await SignInManager.SignInAsync(user, isPersistent: true);

            return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow!
        }
        catch (BusinessException e)
        {
            Alerts.Danger(GetLocalizeExceptionMessage(e));
            return Page();
        }
    }

    [UnitOfWork]
    protected virtual async Task<IdentityUser> RegisterLocalUserAsync()
    {
        using (var unitOfWork = UnitOfWorkManager.Begin())
        {
            ValidateModel();

            var captchaResponse = string.Empty;
            if (UseCaptcha)
            {
                captchaResponse = HttpContext.Request.Form[RecaptchaValidatorBase.RecaptchaResponseKey];
            }

            RegisterDto registerDto = new RegisterDto()
            {
                AppName = "MVC",
                EmailAddress = Input.EmailAddress,
                Password = Input.Password,
                UserName = Input.UserName,
                ReturnUrl = ReturnUrl,
                ReturnUrlHash = ReturnUrlHash,
                CaptchaResponse = captchaResponse
            };

            foreach (var item in Fields)
            {
                if (item.Answers != null)
                {
                    string result = "{";
                    foreach (var answer in item.Answers)
                    {
                        result += '"' + answer + '"';
                        if (!(answer == item.Answers.LastOrDefault()))
                        {
                            result += ",";
                        }
                    }
                    result += "}";
                    item.Answer = result;
                }
                registerDto.SetProperty(item.Title, item.Answer);
            }

            var userDto = await AccountAppService.RegisterAsync(registerDto);

            RegisterUser registerUser = new RegisterUser(userDto.Id, Input.UserName, Input.EmailAddress, TenantId, userDto.CreationTime, "Patient", Input.Password);

            foreach (var key in Fields)
            {
                switch (key.Title)
                {
                    case "Name":
                        registerUser.first_name = key.Answer;
                        break;
                    case "Surname":
                        registerUser.last_name = key.Answer;
                        break;
                    case "DOB":
                        registerUser.dob = DateTime.Parse(key.Answer);
                        break;
                    case "Gender":
                        registerUser.gender = key.Answer;
                        break;
                    default:
                        break;
                }
            }

            await UsersAppService.RegisterUser(registerUser);

            return await UserManager.GetByIdAsync(userDto.Id);

        }
    }

    private async Task<bool> ValidateForm()
    {
        return true;
    }

    protected virtual async Task<IdentityUser> RegisterExternalUserAsync(ExternalLoginInfo externalLoginInfo, string emailAddress)
    {
        await IdentityOptions.SetAsync();

        var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id);

        (await UserManager.CreateAsync(user)).CheckErrors();
        (await UserManager.AddDefaultRolesAsync(user)).CheckErrors();

        if (!user.EmailConfirmed)
        {
            await AccountAppService.SendEmailConfirmationTokenAsync(
                new SendEmailConfirmationTokenDto
                {
                    AppName = "MVC",
                    UserId = user.Id,
                    ReturnUrl = ReturnUrl,
                    ReturnUrlHash = ReturnUrlHash
                }
            );
        }

        var userLoginAlreadyExists = user.Logins.Any(x =>
            x.TenantId == user.TenantId &&
            x.LoginProvider == externalLoginInfo.LoginProvider &&
            x.ProviderKey == externalLoginInfo.ProviderKey);

        if (!userLoginAlreadyExists)
        {
            user.AddLogin(new UserLoginInfo(
                    externalLoginInfo.LoginProvider,
                    externalLoginInfo.ProviderKey,
                    externalLoginInfo.ProviderDisplayName
                )
            );

            (await UserManager.UpdateAsync(user)).CheckErrors();
        }

        return user;
    }

    protected virtual async Task CheckSelfRegistrationAsync()
    {
        if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled) ||
            !await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin))
        {
            throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]);
        }
    }

    protected virtual async Task SetUseCaptchaAsync()
    {
        UseCaptcha = !IsExternalLogin && await SettingProvider.IsTrueAsync(AccountSettingNames.Captcha.UseCaptchaOnRegistration);
        if (UseCaptcha)
        {
            var reCaptchaVersion = await SettingProvider.GetAsync<int>(AccountSettingNames.Captcha.Version);
            await ReCaptchaOptions.SetAsync(reCaptchaVersion == 3 ? reCAPTCHAConsts.V3 : reCAPTCHAConsts.V2);
        }
    }

    protected virtual async Task StoreConfirmUser(IdentityUser user)
    {
        var identity = new ClaimsIdentity(ConfirmUserModel.ConfirmUserScheme);
        identity.AddClaim(new Claim(AbpClaimTypes.UserId, user.Id.ToString()));
        if (user.TenantId.HasValue)
        {
            identity.AddClaim(new Claim(AbpClaimTypes.TenantId, user.TenantId.ToString()));
        }
        await HttpContext.SignInAsync(ConfirmUserModel.ConfirmUserScheme, new ClaimsPrincipal(identity));
    }

    private async Task TrySetEmailAsync()
    {
        if (IsExternalLogin)
        {
            var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
            if (externalLoginInfo == null)
            {
                return;
            }

            if (!externalLoginInfo.Principal.Identities.Any())
            {
                return;
            }

            var identity = externalLoginInfo.Principal.Identities.First();
            var emailClaim = identity.FindFirst(ClaimTypes.Email);

            if (emailClaim == null)
            {
                return;
            }

            Input = new PostInput { EmailAddress = emailClaim.Value };
        }
    }

    public class PostInput
    {
        [Required]
        [DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxUserNameLength))]
        public string UserName { get; set; }

        [Required]
        [EmailAddress]
        [DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxEmailLength))]
        public string EmailAddress { get; set; }

        [Required]
        [DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPasswordLength))]
        [DataType(DataType.Password)]
        [DisableAuditing]
        public string Password { get; set; }

    }

    public class Field
    {
        public int Index { get; set; }
        public string? Title { get; set; }
        public bool IsRequired { get; set; }
        public bool HasOtherOption { get; set; }
        public QuestionTypes QuestionType { get; set; }
        public string? Answer { get; set; }
        public List<string>? Answers { get; set; }
        public List<SelectListItem>? Choices { get; set; }
    }
}

Here the variable "Fields" holds the details of those extra input fields which I am fetching from the database. As you can see those fields would not appear after clicking on Register, can you suggest what can I do so that the fields won't disappear.

  • ABP Framework version: v7.3.2
  • UI Type: Angular / MVC
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I am working on the Auth Server project (independent). I have a requirement where I want to put some extra input fields on the Registration page of auth server. I'd collect the values of those extra input fields and will store those values in my other database table (separate from the ones provided by ABP). I am even able to carry out the whole process and am successfully able to store the data in the database without altering the existing configuration. I am fetching the details of those input fields from my database and storing them in a variable in the Register.cshtml.cs file. And I am using that variable to display those input fields on UI.

Now, here the problem is, that if I have any kind of a validation error (username already taken for example), and if I try to submit at this point, the application will pop out the validation error, saying this username is already taken, which is fine. But all my input fields get disappeared as soon as there is some validation error. I think this is happening because the class is losing all of it's values as soon as there is any validation error and hence it resets all the variables of the class and hence my variable (which stores the input field details), also gets reset and therefore loses all the details and it doesn't appear on the UI.

Is there a way to keep the value of that variable held during the entire time? Any kind of annotation or something? Please suggest.

  • ABP Framework version: v7.3.2
  • UI Type: Angular / MVC
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have a requirement where I am trying to call the FormAppService from the Forms module in my AuthServe. I have to get the form details from the FormId that I will provide. I have done all the configuration. Added the FormHttpApiClientModule in my AuthServer project's module.cs file. I have created an instance of the IFormAppService interface in the Register.cshtml.cs file. And using it I am calling the GetAsync method of the interface which will fetch the form data with the Id parameter. But when the GetAsync method is called it throws the following exception.

NullReferenceException: Object reference not set to an instance of an object. Volo.Abp.Http.Client.ClientProxying.ClientProxyApiDescriptionFinder.Initialize()

DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Volo.Abp.VirtualFileSystem.IVirtualFileProvider, Volo.Abp.Json.IJsonSerializer)' on type 'ClientProxyApiDescriptionFinder'. Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()

DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.Http.Client.ClientProxying.IClientProxyApiDescriptionFinder -> Volo.Abp.Http.Client.ClientProxying.ClientProxyApiDescriptionFinder. Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next)

DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.Http.Client.ClientProxying.IClientProxyApiDescriptionFinder -> Volo.Abp.Http.Client.ClientProxying.ClientProxyApiDescriptionFinder. Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next) Autofac.Core.Resolving.Middleware.SharingMiddleware+<>c__DisplayClass5_0.<Execute>b__0() Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func<object> creator) Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable<Guid> qualifyingId, Func<object> creator) Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next) Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next) Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable<Parameter> parameters, out object instance) Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable<Parameter> parameters) System.Lazy<T>.ViaFactory(LazyThreadSafetyMode mode) System.Lazy<T>.ExecutionAndPublication(LazyHelper executionAndPublication, bool useDefaultConstructor) System.Lazy<T>.CreateValue() Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) Volo.Abp.DependencyInjection.AbpLazyServiceProvider.LazyGetRequiredService<T>() Volo.Abp.Http.Client.ClientProxying.ClientProxyBase<TService>.get_ClientProxyApiDescriptionFinder() Volo.Abp.Http.Client.ClientProxying.ClientProxyBase<TService>.BuildHttpProxyClientProxyContext(string methodName, ClientProxyRequestTypeValue arguments) Volo.Abp.Http.Client.ClientProxying.ClientProxyBase<TService>.RequestAsync<T>(string methodName, ClientProxyRequestTypeValue arguments) Volo.Forms.Forms.ClientProxies.FormClientProxy.GetAsync(Guid id) in FormClientProxy.Generated.cs + return await RequestAsync<FormWithDetailsDto>(nameof(GetAsync), new ClientProxyRequestTypeValue G1.health.AuthServer.Pages.Account.RegisterModel.CreateExtraFields() in Register.cshtml.cs + var form = await FormAppService.GetAsync((Guid)tenant.TenantId); G1.health.AuthServer.Pages.Account.RegisterModel.OnGetAsync() in Register.cshtml.cs + await CreateExtraFields(); Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Convert<T>(object taskAsObject) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Execute(object receiver, object[] arguments) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Builder.ApplicationBuilderAbpOpenIddictMiddlewareExtension+<>c__DisplayClass0_0+<<UseAbpOpenIddictValidation>b__0>d.MoveNext() Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Prometheus.HttpMetrics.HttpRequestDurationMiddleware.Invoke(HttpContext context) Prometheus.HttpMetrics.HttpRequestCountMiddleware.Invoke(HttpContext context) Prometheus.HttpMetrics.HttpInProgressMiddleware.Invoke(HttpContext context) Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

It was working day before yesterday, but all of a sudden it's throwing the above error. I am not sure, what am I missing here. Can you suggest me what can be the possible solution to resolve this?

FYI, I have added all these files manually and not using ABP Suite.

Okay, I understood your point. So, here's a scenario, I have the saas service, which already has few endpoints created by ABP. Now to add some new endpoints, I have created a new AppService called TenantOverrideAppService and similarly the interface for the app service ITenantOverrideAppService, as well the controller TenantOverrideController. Now I am trying to call that endpoint from the Blazor application and it throws the error that it can't find the specific endpoint. While if I use the existing endpoints provided by ABP for the Saas Service, it works. So, what's the configuration that I am missing here. Anything related to proxy? Please elaborate.

Any updates on this?

I have already configured the ocelot.json file

{
  "ServiceKey": "Saas Service",
  "DownstreamPathTemplate": "/api/saas/{everything}",
  "DownstreamScheme": "https",
  "DownstreamHostAndPorts": [
    {
      "Host": "localhost",
      "Port": 44381
    }
  ],
  "UpstreamPathTemplate": "/api/saas/{everything}",
  "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
},

but it still gives the same error.

You mean I have to configure the ocelot.json file right? Also, how is it different from the communication between the microservices?

  • ABP Framework version: v7.3.2
  • UI Type: Angular / Blazor Server
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have created a microservice called FormsService, on which I have added the FormsModule as a project. I want to call the APIs of other microservice into the FormsService microservice (specifically SaasService here). I have followed the following document to do so.

https://docs.abp.io/en/commercial/latest/startup-templates/microservice/synchronous-interservice-communication

The configuration is completed, and the required data is also seeded in the database. But when I run the whole application and try to call an API endpoint from the SaasService, I get an error in my Blazor UI project. I checked the logs of the Blazor UI project, I get the following error :

2023-12-08 20:54:02.276 +05:30 [ERR] Could not found remote action for method: System.Threading.Tasks.Task1[System.Collections.Generic.List1[G1.health.SaasService.TenantDto]] GetTenantNamesList() on the URL: https://localhost:44325 Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task1[System.Collections.Generic.List1[G1.health.SaasService.TenantDto]] GetTenantNamesList() on the URL: https://localhost:44325 at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetActionApiDescriptionModel(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Volo.Forms.Web.Pages.Forms.CreateModalModel.OnGetAsync() in D:\G1 Health WorkSpace\Branches\DEV Branch\G1.health\services\forms\modules\Volo.Forms\src\Volo.Forms.Web\Pages\Forms\CreateModal.cshtml.cs:line 33 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() 2023-12-08 20:54:02.316 +05:30 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'. 2023-12-08 20:54:02.322 +05:30 [INF] Executed page /Forms/CreateModal in 8739.3474ms 2023-12-08 20:54:02.322 +05:30 [INF] Executed endpoint '/Forms/CreateModal' 2023-12-08 20:54:02.323 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44314/Forms/CreateModal - - - 500 - application/json;+charset=utf-8 9008.7077ms

It says that it couldn't find the API endpoint on the 44325 port, but my SaasService runs on the 44381 port. The 44325 port runs the Web Gateway application. I don't understand why the API call is redirected to the 44325 port and not 44381 port. This is the configuration I have done in my FormsService appsettings.json file,

"RemoteServices": { "AbpIdentity": { "BaseUrl": "https://localhost:44381/", "UseCurrentAccessToken": "false" } }, "IdentityClients": { "Default": { "GrantType": "client_credentials", "ClientId": "health_FormsService", "ClientSecret": "1q2w3e*", "Authority": "https://localhost:44322", "Scope": "SaasService" } }

Can you tell me why is it redirecting to the 44325 port? Or is there any configuration I am missing? I have also referred to the following ticket https://support.abp.io/QA/Questions/2268/Questions-regarding-new-microservice-design where it is stated that the Internal Gateway has been removed since last few versions. So, then which port should I be using in the above configuration to make it work? Please guide.

  • ABP Framework version: v7.3.2
  • UI Type: Blazor Server
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have downloaded the Forms Module in my project, and have added one endpoint in one of my controllers. All the other endpoints are working fine, but there's an issue with the new endpoint that I have added. While trying to run my Blazor UI, it throws the following error while starting the Blazor application.

The action 'Volo.Forms.Forms.ClientProxies.FormClientProxy.GetTenantsList (Volo.Forms.HttpApi.Client)' has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer.

Here the GetTenantsList is my endpoint in one of my controllers, can you tell me what I am missing here, do I have to do any configuration in the controller? Please enlighten.

Showing 21 to 30 of 59 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11