What is the analog for HttpListener in .NET Core

I am migrating an application from .NET 4 to .NET Core and cannot find an analogue for the HttpListener class

Error   CS0246  The type or namespace name 'HttpListener' could not be found (are you missing a using directive or an assembly reference?)  

Update1

        private readonly HttpListener _httpListener;

            if (!HttpListener.IsSupported)
        {
            throw new NotSupportedException(
                "The Http Server cannot run on this operating system.");
        }

        _httpListener = new HttpListener();
        _httpListener.Prefixes.Add(prefix);
        _sessionSettings = settings;
+10
source share
2 answers

In .NET Core 2.0, we don’t have this problem (thanks to Martin Ullrich), so now we need to install Visual Studio Preview 2017 version 15.3 where we can use .NET Core 2.0.

But by default (at least at the moment) there is no .NET Core 2.0, and we need to install it after installing VS 2017.

PS: - - , 10 ( 3 ).NET Core 2.0 -

+7

, WebListener ( Microsoft.Net.Http.Server NuGet) , API. HTTP- Kestrel, ASP.NET Core, ( ).

, .NET Core 2.0, API- HttpListener, .

+17

Source: https://habr.com/ru/post/1017231/


All Articles