Hi,
When we run web-host in Debian, the service starts but is not accessible from the outside of the box.
In the meantime the service can be successfully accessed inside the box, e.g. with the command: curl -L http://localhost:5000 No firewall involved, service just binds to the localhost network interface instead of external interface.
We use ASP.NET CORE & Angular version of template (two separate VS solutions), template version 7.2.3. We running as Kestrel on Debian 10 and .NET Core 2.2.7 with simple command: dotnet <myproject>.Web.Host.dll Binaries were published from Visual Studio 2017 using simple publishing to a folder ("File System" publish method).
We have tried to put Kestrel configuration options in appsettings.json Something similar to config example described here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.2#listenoptionsusehttps-1
{
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://*:5555"
}
}
}
}
But looks like service does not use this configuration.
- How can we configure service to bind network interface other than localhost, e.g. bind to http://*:5000
- How can we configure service to listen on different port, e.g. http://localhost:5555 or better http://*:5555
- How can we make other Kestrel options in appsettings.json be respected by the service, as described in https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.2#kestrel-options-1
Thanks!
2 Answer(s)
-
1
public class Program { public static void Main(string[] args) { CurrentDirectoryHelpers.SetCurrentDirectory(); CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) { return new WebHostBuilder() .ConfigureAppConfiguration((hostingContext, config) => { var env = hostingContext.HostingEnvironment; config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); if (env.IsDevelopment()) { config.AddUserSecrets(typeof(Program).Assembly, optional: true); } config.AddEnvironmentVariables(); if (args != null) { config.AddCommandLine(args); } }) .UseKestrel((builderContext, options) => { options.Configure(builderContext.Configuration.GetSection("Kestrel")); }) .UseContentRoot(Directory.GetCurrentDirectory()) .UseIIS() .UseIISIntegration() .UseStartup<Startup>(); } }
-
0
It works. Thank you!