Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Abp.AbpException: Must set LocalizationSourceName before #703


User avatar
0
owen84 created

I get this error when i try to authenticate a user using the api endpoint - <a class="postlink" href="http://localhost:6634/api/account/authenticate">http://localhost:6634/api/account/authenticate</a>

The application is trying to return a InvalidUserNameOrPassword but it seems to be causing the exception when trying to localize the end message.

I dont think we will be using any localization features for this project and have the default locale 'always on' is a good solution for me. Could you please let me know how i can do this?

The below is the stack trace:

Abp.AbpException: Must set LocalizationSourceName before, in order to get LocalizationSource at Abp.WebApi.Controllers.AbpApiController.get_LocalizationSource() at Abp.WebApi.Controllers.AbpApiController.L(String name) at Zygo.Api.Controllers.AccountController.CreateExceptionForFailedLoginAttempt(AbpLoginResultType result, String usernameOrEmailAddress, String tenancyName) in C:\git\Zygo-Latest\Zygo.WebApi\Api\Controllers\AccountController.cs:line 75 at Zygo.Api.Controllers.AccountController.<GetLoginResultAsync>d__8.MoveNext() in C:\git\Zygo-Latest\Zygo.WebApi\Api\Controllers\AccountController.cs:line 63 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Zygo.Api.Controllers.AccountController.<Authenticate>d__7.MoveNext() in C:\git\Zygo-Latest\Zygo.WebApi\Api\Controllers\AccountController.cs:line 39 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()


4 Answer(s)
  • User Avatar
    0
    fabil created

    AbpApiController is missing the initialization for LocalizationSourceName.

    Quickfix: in app\WebApi\Api\Controllers\AccountController.cs

    public AccountController(LogInManager logInManager)
            {
                _logInManager = logInManager;
                LocalizationSourceName = HumanTaskConsts.LocalizationSourceName;  <===== Insert this
            }
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Thank you. Additonal info: This is fixed (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/commit/62ee93ca6dec602882334b33896a9b4d3df1b283">https://github.com/aspnetboilerplate/mo ... 4d3df1b283</a>) but not released yet.

  • User Avatar
    0
    fretje created

    I have exactly the same problem, although I'm working with the asp.net core version of the template, and there the LocalizationSourceName is actually set in the constructor of the MyAppControllerBase class...

    I don't know what else I can do to fix this problem...

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sorry for the late reply. Did you solve your problem ?

    If not, can you share your controller definition ?

    Thanks.