- ABP Framework version: v8.0.0
- UI Type: MVC
- Database System: EF Core (SQL Server)
- Tiered (for MVC) or Auth Server Separated (for Angular): no
- Exception message and full stack trace:
- Steps to reproduce the issue:
Wanted to deploy the app as a window service with kestrel server. But facing following error when starting the server,
And also wanted to implement Active directory integration with it. Any suggestions would be great.
Please find my program.cs code and let me know the required change if any,
using Pentapack.MRS.Data;
using Serilog;
using Serilog.Events;
using Volo.Abp.Data;
namespace Pentapack.MRS;
public class Program
{
public static async Task<int> Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(serverOptions =>
{
serverOptions.ListenAnyIP(5000); // http
});
var loggerConfiguration = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Warning()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.Enrich.WithProperty("Application", "Pentapack.MRS")
.WriteTo.Async(c => c.File(builder.Configuration["App:LogFilePath"]))
.WriteTo.Async(c => c.Console());
if (IsMigrateDatabase(args))
{
loggerConfiguration.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning);
loggerConfiguration.MinimumLevel.Override("Microsoft", LogEventLevel.Warning);
}
Log.Logger = loggerConfiguration.CreateLogger();
try
{
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
if (IsMigrateDatabase(args))
{
builder.Services.AddDataMigrationEnvironment();
}
builder.Services.AddWindowsService();
await builder.AddApplicationAsync<MRSModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
if (IsMigrateDatabase(args))
{
await app.Services.GetRequiredService<MRSDbMigrationService>().MigrateAsync();
return 0;
}
Log.Information("Starting Pentapack.MRS.");
await app.RunAsync();
return 0;
}
catch (Exception ex)
{
if (ex is HostAbortedException)
{
throw;
}
Log.Fatal(ex, "Pentapack.MRS terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
private static bool IsMigrateDatabase(string[] args)
{
return args.Any(x => x.Contains("--migrate-database", StringComparison.OrdinalIgnoreCase));
}
}
5 Answer(s)
-
0
hi
Wanted to deploy the app as a window service with kestrel server. But facing following error when starting the server,
Are there any error logs on logs.txt and Win Event Viewer?
-
0
hi
Wanted to deploy the app as a window service with kestrel server. But facing following error when starting the server,
Are there any error logs on logs.txt and Win Event Viewer?
please find the logs as below
2024-01-09 19:52:45.005 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.005 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.005 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.016 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.017 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.020 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.020 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.023 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.024 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.033 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.042 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.051 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.052 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.061 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.065 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.065 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.077 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.085 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.086 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.087 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.089 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.104 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.115 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.124 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.125 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.125 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.128 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.132 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.140 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.149 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.149 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.151 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.160 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.170 +05:30 [ERR] ABP-LIC-0021 - The path is empty. (Parameter 'path') 2024-01-09 19:52:45.371 +05:30 [INF] User profile is available. Using 'C:\Users\Lsiva\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
-
0
hi
Do you have
appsettings.secrets.json
andAbpLicenseCode
inside your app?Can your app run successfully without window service ?
-
0
hi
Do you have
appsettings.secrets.json
andAbpLicenseCode
inside your app?Can your app run successfully without window service ?
Yes. I do have appsettings.secrets.json with AbpLicenseCode. It is running fine on iis and docker without any issues.
-
0
To diagnose the problem, there are 2 things to do:
To understand the correct paths, write a new simple console app and run this app as a Windows service. Log the following variables and send me the values. Can you see if the files are there in these paths? (If not, copy
access-token.bin
andAbpLicense.bin
from your computer to the Server's related folders.)
TokenPath:
string TokenPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile), ".abp", "cli", "access-token.bin");
LicensePath:
string LicensePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "AbpLicense.bin");