Dear sirs,
I have a project that works well with the abp studio. when i install on a iis server, the swagger app works fine. the angular app, also runs. but when i try to login, i get an http 400 error on the angular app. i have 3 web sites, but the auth is not running so i'm using only one.
When i want to test via swagger i can authenticate. also i can authenticate on the backoffice app. But i get this error:
the angular web.config:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect" stopProcessing="true"> <match url="getEnvConfig" /> <action type="Redirect" url="dynamic-env.json" /> </rule> <rule name="Angular Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="./index.html" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
The dynamic-env.json: { "apiUrl": "https://apilogistics.example.com", "issuer": "https://logistics.example.com", "clientId": "logistics_App" }
Also, i dont' know if i need the auth website and if yes, what files should i put there? I think that this part is not well documented or at least i can't find it anywhere.
BEst regards
- ABP Framework version: v8.3.2
- UI Type: Angular
- Database System: EF Core (SQL Server)
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
- Exception message and full stack trace:
- Steps to reproduce the issue: https://apilogistics.example.com/Error?httpStatusCode=400
13 Answer(s)
-
0
hi
You have to run these three websites.
AuthServer, API, and angular app.
Please share the logs.txt of the 400 error.
https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=MVC&DB=EF&Tiered=Yes https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-9.0&tabs=visual-studio
Thanks.
-
0
hi maliming
I've made a mistake. i'm not using tiered. In my project, i don't have the authserver project.
I can authenticate on my swagger app. I can't on the angular app
Warm regards
You have to run these three websites.
AuthServer, API, and angular app.
Please share the logs.txt of the 400 error.
https://abp.io/docs/commercial/latest/startup-templates/application/deployment-iis?UI=MVC&DB=EF&Tiered=Yes https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-9.0&tabs=visual-studio
Thanks.
-
0
hi
ok, Please share the full
logs.txt
of your applications.Thanks.
liming.ma@volosoft.com
-
0
Hi Maliming
I dont' have any logs.txt file in my development machine nor on the server i'm trying to deploy.
Warn regards
-
0
hi
I dont' have any logs.txt file in my development machine nor on the server i'm trying to deploy.
Please check your
Program.cs
, theLogs.txt
is configured. You can set the.MinimumLevel.Debug()
to see more logs..WriteTo.Async(c => c.File("Logs/logs.txt"))
public class Program { public async static Task<int> Main(string[] args) { Log.Logger = new LoggerConfiguration() .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateBootstrapLogger(); try { Log.Information("Starting web host."); var builder = WebApplication.CreateBuilder(args); builder.Host .AddAppSettingsSecretsJson() .UseAutofac() .UseSerilog((context, services, loggerConfiguration) => { loggerConfiguration .MinimumLevel.Debug() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .WriteTo.Async(c => c.AbpStudio(services)); }); await builder.AddApplicationAsync<MyProjectNameWebModule>(); var app = builder.Build(); await app.InitializeApplicationAsync(); await app.RunAsync(); return 0; } catch (Exception ex) { Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } finally { Log.CloseAndFlush(); } } }
-
0
My logs.txt has only this:
2024-11-25 17:47:17.122 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-25 19:00:53.923 +01:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-25 18:11:27.428 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-27 02:30:42.759 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-27 16:01:41.359 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-28 15:27:00.806 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-28 16:22:57.155 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-28 16:26:35.844 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-11-29 22:55:14.283 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-01 10:48:12.210 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-02 16:09:13.707 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-03 21:23:55.509 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-05 03:23:41.662 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-06 20:11:38.773 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-08 14:32:58.605 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-11 17:51:37.961 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-13 06:09:56.235 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-14 14:31:20.516 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-15 21:17:50.541 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-17 05:56:20.641 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-18 19:55:52.328 +00:00 [INF] Starting amce.logistics.HttpApi.Host. 2024-12-20 06:54:17.003 +00:00 [INF] Starting amce.logistics.HttpApi.Host.
Can you please tell me how should i configure the auth in the angular app, since i don't have the authserver project?
Warm regards
-
0
hi
Can you share a screenshot of your solution structure?
How many web projects are in your solution?
-
0
-
0
hi
I see, Please share the
Program.cs
of yourlogistics.HttpApi.Host
project.We need to output more logs.
Thanks.
-
0
Hi Maliming
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; namespace acme.logistics; public class Program { public async static Task<int> Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG .MinimumLevel.Debug() #else .MinimumLevel.Information() #endif .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateLogger(); try { Log.Information("Starting acme.logistics.HttpApi.Host."); var builder = WebApplication.CreateBuilder(args); builder.Host .AddAppSettingsSecretsJson() .UseAutofac() .UseSerilog((context, services, loggerConfiguration) => { loggerConfiguration.WriteTo.Async(c => c.AbpStudio(services)); }); await builder.AddApplicationAsync<logisticsHttpApiHostModule>(); var app = builder.Build(); await app.InitializeApplicationAsync(); await app.RunAsync(); return 0; } catch (Exception ex) { if (ex is HostAbortedException) { throw; } Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } finally { Log.CloseAndFlush(); } } }
-
0
hi
Change the Program as below, then republish to IIS and get logs.txt again.
Thanks
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; namespace acme.logistics; public class Program { public async static Task<int> Main(string[] args) { Log.Logger = new LoggerConfiguration() .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateBootstrapLogger(); try { Log.Information("Starting MyCompanyName.MyProjectName.HttpApi.Host."); var builder = WebApplication.CreateBuilder(args); builder.Host .AddAppSettingsSecretsJson() .UseAutofac() .UseSerilog((context, services, loggerConfiguration) => { loggerConfiguration .MinimumLevel.Debug() .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()); }); await builder.AddApplicationAsync<logisticsHttpApiHostModule>(); var app = builder.Build(); await app.InitializeApplicationAsync(); await app.RunAsync(); return 0; } catch (Exception ex) { if (ex is HostAbortedException) { throw; } Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } finally { Log.CloseAndFlush(); } } }
-
0
Hi Mailming
The log is huge and it was not possible to paste it here. i send the lines reated with the error:
I can send you the full log via wetransfer if you want.
2024-12-26 14:01:16.339 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ApplyAuthorizationResponseContext was marked as handled by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ProcessStatusCodePagesErrorResponse
1[[OpenIddict.Server.OpenIddictServerEvents+ApplyAuthorizationResponseContext, OpenIddict.Server, Version=5.5.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]. 2024-12-26 14:01:16.340 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+Authentication+ApplyAuthorizationResponse
1[[OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext, OpenIddict.Server, Version=5.5.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]. 2024-12-26 14:01:16.340 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext was marked as handled by OpenIddict.Server.OpenIddictServerHandlers+Authentication+ApplyAuthorizationResponse`1[[OpenIddict.Server.OpenIddictServerEvents+ProcessErrorContext, OpenIddict.Server, Version=5.5.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]]. 2024-12-26 14:01:16.341 +00:00 [INF] Request finished HTTP/2 GET https://apilogistics.acme.com/connect/authorize?response_type=code&client_id=logistics_App&state=cmFISk5SZEQ1V1ZpY2FxRkU3QnBEbS5hTEt6Z1lxQ0xWQ2xoeTNMTnYyVkxG&redirect_uri=https%3A%2F%2Flogistics.acme.com%2F&scope=openid%20offline_access%20logistics&code_challenge=JcVqG3JboY0WKiEot7JPeFi-W53uLsJAkV0eXFivpCc&code_challenge_method=S256&nonce=cmFISk5SZEQ1V1ZpY2FxRkU3QnBEbS5hTEt6Z1lxQ0xWQ2xoeTNMTnYyVkxG&culture=en&ui-culture=en - 302 null null 584.3075ms 2024-12-26 14:01:16.347 +00:00 [INF] Request starting HTTP/2 GET https://apilogistics.acme.com/Error?httpStatusCode=400 - null null 2024-12-26 14:01:16.349 +00:00 [DBG] The request path /Error does not match a supported file type 2024-12-26 14:01:16.349 +00:00 [DBG] 1 candidate(s) found for the request path '/Error' 2024-12-26 14:01:16.349 +00:00 [DBG] Endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' with route pattern '{controller=Home}/{action=Index}/{id?}' is valid for the request path '/Error' 2024-12-26 14:01:16.349 +00:00 [DBG] Request matched endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. 2024-12-26 14:01:16.350 +00:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2024-12-26 14:01:16.355 +00:00 [DBG] AuthenticationScheme: Identity.Application was not authenticated. 2024-12-26 14:01:16.355 +00:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. 2 -
0
hi
I can send you the full log via wetransfer if you want.
Please. liming.ma@volosoft.com