Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Core – Kestrel – Port Sharing – Alternative

Currently we are moving from .Net Framework (4.7) to .Net Core / Asp.Net Core.

We are having a few micro services which are using WebAPI and listening on the same port (443).

And we have a single page application (which consists of a few modules (logical units)) and all modules are communicating with our micro services using the same port (443).

With Asp.Net Core port sharing is not supported when using Kestrel, are there any other options then using a reverse proxy like Nginx, Appache (to "redirect" to different ports)?

We can’t use IIS as reverse proxy because we are using gRPC as well which is currently not supported by the IIS.

If the reverse proxy solution is the right way (I personally think it is, because of the MS-doku, can you recommend a reverse proxy, we are using Windows and need support for spnego (Kerberos, NTLM v1, v2), at least the proxy should be able to forward spnego to our IIS which we will probably use for other applications and single sign on solution.

Nginx seems pretty good, but has no build in support for spnego (only in the paied/commercial version).

Br

like image 961
rene_r Avatar asked Apr 23 '20 05:04

rene_r


Video Answer


1 Answers

I know that this is 7 months old question, but if using an HTTPListener is acceptable than my solution to this problem was like this:

Host.CreateDefaultBuilder(args)
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.UseStartup<Startup>();
    })
    .ConfigureWebHost(config =>
    {
            //We are sharing port with .net HTTPListener object with streaming service on SF cluster so we need to use old HTTP.sys and we can not use new Kestrel
        config.UseHttpSys(options =>
        {
            options.UrlPrefixes.Add(urlPrefix);
        });
    })
    .Build()

One of our services in StatelessService is using prefix "https://+:[portNr]", and asp.net Core host is using "https://+:[portNr]/ws"

Maybe it will be useful to someone

like image 80
FTL_n3d Avatar answered Oct 20 '22 10:10

FTL_n3d