<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/6eedd8a06a0358b089beb669c20e86173646fa11/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Configuration/AppConfigurations.cs#L17">https://github.com/aspnetzero/aspnet-ze ... ons.cs#L17</a>
The Get method of AppConfigurations needs to pass the environmentName. E.g. Production
Don't use Asynchronous inside List<T>.ForEach. Try foreachor for
This is my practice, for reference only. Use razor pages to write a simple login function page. Then use cookie authorization. Now you can access the hangfire page that requires authorization.
Simple code:
public async Task<ActionResult> OnGet()
{
using (var uow = _unitOfWorkManager.Begin())
{
var loginResult = await _logInManager.LoginAsync("admin", "qq1234", "Default");
if (loginResult.Result == AbpLoginResultType.Success)
{
await _signInManager.SignInAsync(loginResult.User, true);
}
uow.Complete();
return Page();
}
}
By default: Log in to the system and the current user has the "AppPermissions.Pages_Administration_HangfireDashboard" permission.
Which project are you using in the HangfireDashboard? XXX.MVC or XXX.Host?
You should check in the application whether the field is unique in the database. ([https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Zero/Authorization/Users/AbpUserManager.cs#L396])) Instead of waiting for the database to return an exception message.
The database exception message is "unreadable" to the user. Non-professionals may not understand the database error message.
await CurrentUnitOfWork.SaveChangesAsync()
You have to remember to add await
Still can't catch the exception?
Call CurrentUnitOfWork.SaveChangesAsync() to catch exceptions
try
{
//db operations.
CurrentUnitOfWork.SaveChangesAsync()
}
catch (DbUpdateException e)
{
SqlException s = e.InnerException.InnerException as SqlException;
//handle and see your exception
}
These are the database error messages, I think should not be displayed to the UI. The application should avoid this error. For example, do parameter verification and supplement unit testing.
Even if this kind of message is displayed to the UI, sometimes it does not understand what is going on.
There will be some logs when "An internal error occurred during your request".
Please take a look at the application's log.
The application will automatically initialize the data when it starts. So start your website.
Please share all the code of UserFriendsCache.cs.