.NET Core中HttpListener的模拟是什么 [英] What is analog for HttpListener in .NET Core

查看:287
本文介绍了.NET Core中HttpListener的模拟是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将应用程序从.NET 4移植到.NET Core,找不到HttpListener类的模拟

I'm porting application from .NET 4 to .NET Core and can't find analog for 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;


推荐答案

在.NET Core 2.0中,我们没有问题(感谢Martin Ullrich),所以现在我们需要安装 Visual Studio Preview 2017 15.3版可以使用.NET Core 2.0。

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

但是默认情况下(目前最低),没有.NET Core 2.0,我们需要在VS 2017安装后安装

But by default (as minimum for now) there don't have .NET Core 2.0 and we need install it after VS 2017 installation.

PS:-再次感谢Martin Ullrich-太神奇了,只有5月10日(在我问之前3天).NET Core 2.0 正在宣布-现在我知道了

P.S: - thanks again Martin Ullrich - it's amazing, only 10 May ( 3 days before I have asking) .NET Core 2.0 was announcing - and I have it now

这篇关于.NET Core中HttpListener的模拟是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆