Please share the logs when the request is slowly.
Sorry, I can't provide the log now, when I run into the question, I'll reopen and paste the log.
hi
Please check the logs of the backend.
Are you set the Redis?
Hi, We don't use Redis, In development the backend logs don't has exception.
I think I know the use of callback option in integration OIDC authentication, It's solved, thanks a lot.
--- End of inner exception stack trace --- at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync() at IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.HandleRequestAsync() 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.<
context.Services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "ProjectName";
options.BackchannelHttpHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback =
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
})
.AddOpenIdConnect("xxx", "xxx", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;
options.Authority = "https://xxx/";
options.CallbackPath = "/";
options.ClientSecret = configuration["MyIdAuthServer:ClientSecret"];
options.ClientId = configuration["MyIdAuthServer:ClientId"];
options.ResponseType = OpenIdConnectResponseType.Code;
options.BackchannelHttpHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback =
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
});
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Project.HttpApi.Host": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:44361",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
dotnet watch --project xxx run -c Debug --launch-profile=Project.HttpApi.Host
This exception don't affect normal use.
when I visit https://localhost:44361/home
or https://localhost:44361/swagger
, the program don't throw this exception msg, so I guess this question is because I add OpenId authentication
, I think set program default application URL to https://localhost:44361/home
or https://localhost:44361/swagger
,this question can be solved, but after I add "launchUrl": "swagger"
to launchSetting.json
file, it don't work.
PS: when I remove options.CallbackPath = "/";
of OpenId authentication
, this exception msg is don't throw too, but I can't remove this setting, because if I do that, OpenId authentication
can't work.
So can you help me? thanks a lot!
Hi @ldacnfinit, can you try to create a UOW in your
ImportByExcelFile
method manually, like below:private readonly IUnitOfWorkManager _unitOfWorkManager; public virtual async Task> ImportByExcelFile(IFormFile file) { using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) { //... await _identityUserManager.CreateAsync(ObjectMapper.Map(s), userPwd, false); await uow.CompleteAsync(); } }
https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work
Ok, Thanks a lot! It works!
hi
Please share full error info.
Because the number of log words exceeded the maximum allowed for a post, I posted a blog with a link to https://www.cnblogs.com/zinan/p/16007487.html
ABP Framework version: v4.4.3
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
Exception message and stack trace: If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.Object name: 'IdentityDbContext'.
Steps to reproduce the issue:"
[UnitOfWork]
public virtual async Task<ListResultDto<AppUserDto>> ImportByExcelFile(IFormFile file)
{
...
await _identityUserManager.CreateAsync(ObjectMapper.Map<CreateUpdateAppUserDto, IdentityUser>(s), userPwd, false);
...
}
已经在开发环境解决了认证授权问题,但是在部署到生产环境时,在请求第三方认证站点时出现了CORS 问题,部署环境为 IIS,请问如何解决这个问题。
尝试过以下两种方案:
第一种,使用 Angular Proxy config,但是没生效
第二种,将 oAuthConfig
的issuer
设置为源站,在 IIS 中将请求转发到认证站点,但出现了新问题 main-es2015.22bb79fb162f00377e5b.js:1 invalid issuer in discovery document expected: https://源站.com.cn current: https://认证.xxx.com
,所以还是需要使用第一种,直接解决跨域的问题