Base solution for your next web application

Activities of "alramz"

Hi oguzhanagir,

Please find below the unchanged FillRoleNames method: private async Task FillRoleNames(IReadOnlyCollection<UserListDto> userListDtos) { /* This method is optimized to fill role names to given list. */ var userIds = userListDtos.Select(u => u.Id);

var userRoles = await _userRoleRepository.GetAll()
    .Where(userRole => userIds.Contains(userRole.UserId))
    .Select(userRole => userRole).ToListAsync();

var distinctRoleIds = userRoles.Select(userRole => userRole.RoleId).Distinct();

foreach (var user in userListDtos)
{
    var rolesOfUser = userRoles.Where(userRole => userRole.UserId == user.Id).ToList();
    user.Roles = ObjectMapper.Map&lt;List&lt;UserListRoleDto&gt;>(rolesOfUser);
}

var roleNames = new Dictionary&lt;int, string&gt;();
foreach (var roleId in distinctRoleIds)
{
    var role = await _roleManager.FindByIdAsync(roleId.ToString());
    if (role != null)
    {
        roleNames[roleId] = role.DisplayName;
    }
}

foreach (var userListDto in userListDtos)
{
    foreach (var userListRoleDto in userListDto.Roles)
    {
        if (roleNames.ContainsKey(userListRoleDto.RoleId))
        {
            userListRoleDto.RoleName = roleNames[userListRoleDto.RoleId];
        }
    }

    userListDto.Roles = userListDto.Roles.Where(r => r.RoleName != null).OrderBy(r => r.RoleName).ToList();
}

}

Hi oguzhanagir,

Could you please clarify where these SQL statements can be found? as we haven't changed any of the relevant code for this?

Thank you,

Hi @m.aliozkaya,

Please find below the logs generated:

DEBUG 2024-10-04 09:54:52,146 [31 ] Abp.AspNetCore.SignalR.Hubs.AbpCommonHub - A client is registered: vxEmIxuLt6I8zJa6MuqeIg WARN 2024-10-04 09:54:52,191 [44 ] EntityFrameworkCore.Database.Transaction - 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 and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'. INFO 2024-10-04 09:54:52,238 [46 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 GET https://localhost:44302/signalr-chat?id=Nx6eFZXFvleunmWY5P_LVg - - - INFO 2024-10-04 09:54:52,329 [20 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2024-10-04 09:54:52,342 [20 ] c.Infrastructure.ControllerActionInvoker - Executed action AlRamzPortal.Notifications.NotificationAppService.ShouldUserUpdateApp (AlRamzPortal.Application) in 222.4097ms INFO 2024-10-04 09:54:52,344 [20 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'AlRamzPortal.Notifications.NotificationAppService.ShouldUserUpdateApp (AlRamzPortal.Application)' INFO 2024-10-04 09:54:52,345 [20 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/2 POST https://localhost:44302/api/services/app/Notification/ShouldUserUpdateApp - 200 - application/json;+charset=utf-8 448.5083ms INFO 2024-10-04 09:54:52,440 [46 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint '/signalr-chat' DEBUG 2024-10-04 09:54:52,488 [47 ] AlRamzPortal.Web.Chat.SignalR.ChatHub - A client is connected: {"ConnectionId":"EaW642rpQzbdT-59Fvuiqg","IpAddress":"127.0.0.1","TenantId":1,"UserId":2,"ConnectTime":"2024-10-04T09:54:52.4884714+04:00","Properties":{}} INFO 2024-10-04 09:54:52,490 [48 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/2 GET https://localhost:44302/api/services/app/Chat/GetUserChatFriendsWithSettings - application/json - DEBUG 2024-10-04 09:54:52,528 [44 ] AlRamzPortal.Web.Chat.SignalR.ChatHub - A client is registered: EaW642rpQzbdT-59Fvuiqg INFO 2024-10-04 09:54:52,552 [46 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'AlRamzPortal.Chat.ChatAppService.GetUserChatFriendsWithSettings (AlRamzPortal.Application)' INFO 2024-10-04 09:54:52,553 [46 ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "GetUserChatFriendsWithSettings", controller = "Chat"}. Executing controller action with signature System.Threading.Tasks.Task1[AlRamzPortal.Chat.Dto.GetUserChatFriendsWithSettingsOutput] GetUserChatFriendsWithSettings() on controller AlRamzPortal.Chat.ChatAppService (AlRamzPortal.Application). INFO 2024-10-04 09:54:52,557 [46 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2024-10-04 09:54:52,559 [46 ] c.Infrastructure.ControllerActionInvoker - Executed action AlRamzPortal.Chat.ChatAppService.GetUserChatFriendsWithSettings (AlRamzPortal.Application) in 6.0811ms INFO 2024-10-04 09:54:52,559 [46 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'AlRamzPortal.Chat.ChatAppService.GetUserChatFriendsWithSettings (AlRamzPortal.Application)' INFO 2024-10-04 09:54:52,559 [46 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/2 GET https://localhost:44302/api/services/app/Chat/GetUserChatFriendsWithSettings - 200 - application/json;+charset=utf-8 68.6388ms WARN 2024-10-04 09:54:52,581 [44 ] EntityFrameworkCore.Database.Transaction - 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 and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'. INFO 2024-10-04 09:54:52,589 [47 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2024-10-04 09:54:52,591 [47 ] c.Infrastructure.ControllerActionInvoker - Executed action AlRamzPortal.DynamicEntityProperties.DynamicEntityPropertyAppService.GetAllEntitiesHasDynamicProperty (AlRamzPortal.Application) in 731.7857ms INFO 2024-10-04 09:54:52,591 [47 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'AlRamzPortal.DynamicEntityProperties.DynamicEntityPropertyAppService.GetAllEntitiesHasDynamicProperty (AlRamzPortal.Application)' INFO 2024-10-04 09:54:52,592 [47 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/2 GET https://localhost:44302/api/services/app/DynamicEntityProperty/GetAllEntitiesHasDynamicProperty - 200 - application/json;+charset=utf-8 822.7987ms ERROR 2024-10-04 09:54:53,396 [44 ] oft.EntityFrameworkCore.Database.Command - Failed executing DbCommand (645ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__CurrentTenantId_1='?' (DbType = Int32), @__userIds_0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30'] SELECT [a].[Id], [a].[CreationTime], [a].[CreatorUserId], [a].[RoleId], [a].[TenantId], [a].[UserId] FROM [AbpUserRoles] AS [a] WHERE (@__ef_filter__p_0 = CAST(1 AS bit) OR [a].[TenantId] = @__ef_filter__CurrentTenantId_1) AND [a].[UserId] IN ( SELECT [u].[value] FROM OPENJSON(@__userIds_0) WITH ([value] bigint '$') AS [u] ) ERROR 2024-10-04 09:54:53,789 [44 ] Microsoft.EntityFrameworkCore.Query - An exception occurred while iterating over the results of a query for context type 'AlRamzPortal.EntityFrameworkCore.AlRamzPortalDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'WITH'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:6f96ed7b-254e-40d6-aba0-d5212a56f19d Error Number:156,State:1,Class:15 Microsoft.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'WITH'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:6f96ed7b-254e-40d6-aba0-d5212a56f19d Error Number:156,State:1,Class:15 WARN 2024-10-04 09:54:54,589 [44 ] EntityFrameworkCore.Database.Transaction - 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 and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'. ERROR 2024-10-04 09:54:54,734 [48 ] Mvc.ExceptionHandling.AbpExceptionFilter - Incorrect syntax near the keyword 'WITH'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. Microsoft.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'WITH'. Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at AlRamzPortal.Authorization.Users.UserAppService.FillRoleNames(IReadOnlyCollection1 userListDtos) in C:\Users\mtariq\source\repos\Portal\src\AlRamzPortal.Application\Authorization\Users\UserAppService.cs:line 412 at AlRamzPortal.Authorization.Users.UserAppService.GetUsers(GetUsersInput input) in C:\Users\mtariq\source\repos\Portal\src\AlRamzPortal.Application\Authorization\Users\UserAppService.cs:line 121 at lambda_method2658(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.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.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) ClientConnectionId:6f96ed7b-254e-40d6-aba0-d5212a56f19d Error Number:156,State:1,Class:15 INFO 2024-10-04 09:54:54,741 [48 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2024-10-04 09:54:54,743 [48 ] c.Infrastructure.ControllerActionInvoker - Executed action AlRamzPortal.Authorization.Users.UserAppService.GetUsers (AlRamzPortal.Application) in 2882.9018ms INFO 2024-10-04 09:54:54,743 [48 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'AlRamzPortal.Authorization.Users.UserAppService.GetUsers (AlRamzPortal.Application)' INFO 2024-10-04 09:54:54,743 [48 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/2 POST https://localhost:44302/api/services/app/User/GetUsers - 500 - application/json;+charset=utf-8 2964.0545ms

Hello,

I am facing an issue while accessing the users page in my asp.net zero application. It throws an internal error every time as shown below: While the browser logs display an error while calling the GetUsers API:

I'm unsure as to why this is occurring, any help is appreciated.

Hi @alramz

If you have access to database, you can reset password of the related account. You can find encpypted default password in HostRoleAndUserCreator.cs.

Hello,

We were able to update it using the provided information. Thank you for the help.

Hi,

We need assistance recovering access to the admin account for a deployed .NET Zero website. Please let us know how to proceed.

Thank you.

We have just sent it. Thanks

Hi @alramz,

Could you check your cookies? Maybe it's related to cookies

Hello, Yes, we have tried clearing cookies and cache before running the solution but that did not fix it.

Hi @alramz

Is it possible to share the live app URL and steps to reproduce this case ? If you want to keep it private, you can send an email to [email protected].

Gentle reminder of the previous request. Thanks

Hi @alramz

Is it possible to share the live app URL and steps to reproduce this case ? If you want to keep it private, you can send an email to [email protected].

Hello, Thanks for replying. The app has not been deployed to the internet, but rather to an IP address that is only available on our local network.

Here are the steps we followed: We have published the Web.MVC project through Visual Studio with the following settings: Then, we followed the following steps which reproduced the redirection issue.

  1. Connect remotely to the server.
  2. Paste the generated "publish" into the server files
  3. Open IIS
  4. Create new subsite and choose the location of where the "publish" folder is stored

After following the previous steps, we were able to access the website that have been made using ASP.NET Zero. However, we cannot get past the login page when logging in with the default admin account. Running the solution locally through Visual Studio works completely fine though. We checked with several incorrect credentials, and it produces an incorrect username/password error. This shows that authentication works fine, however, the page keeps redirecting to the login page when we enter the correct credentials.

Showing 1 to 10 of 12 entries