如果你还在用net4.5,如果你还在用netframework,又想使用netcore2.1的库或者功能,又觉得nuget动不动就好大,可以试试下面的这个。

https://pan.baidu.com/s/1uxywusd485RgqxSnuVTzQw

就一个dll,里面netcore新增的功能,比如span,比如新的非winhttp.dll的httpclient,都可以用

例:

创建一个新的console netframework4.5的项目

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore;

namespace testhttp
{
class Program
{
static void Main(string[] args)
{
Http();
}

static void Http()
{
var host = new WebHostBuilder()
.UseKestrel(options =>
{
// options.ThreadCount = 4;
//options.NoDelay = true;
//options.UseConnectionLogging();
})
.UseUrls("http://127.0.0.1:5001")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}

public class Startup
{
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Trace);

app.Run(async context =>
{
Console.WriteLine("{0} {1}{2}{3}",
context.Request.Method,
context.Request.PathBase,
context.Request.Path,
context.Request.QueryString);
Console.WriteLine("Method:{0}", context.Request.Method);
Console.WriteLine("PathBase:{0}", context.Request.PathBase);
Console.WriteLine("Path:{0}", context.Request.Path);
Console.WriteLine("QueryString:{0}", context.Request.QueryString);

var connectionFeature = context.Connection;
Console.WriteLine("Peer:{0}", connectionFeature.RemoteIpAddress.ToString());
Console.WriteLine("Sock:{0}", connectionFeature.LocalIpAddress.ToString());

context.Response.ContentLength = 11;
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Hello world");
});
}
}
}

这样就可以了,对了libuv你自己下一个,丢到输出目录 ,或者用这个nuget

https://www.nuget.org/packages/Libuv/

最新文章

  1. SharePoint 2013 create workflow by SharePoint Designer 2013
  2. dede织梦批量导入关键词
  3. 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null
  4. Javaweb命名规则
  5. .NET开源项目常用记录
  6. ACM 擅长排列的小明
  7. JAVA为什么要配置环境变量,怎样配置
  8. CoffeeScript学习(1)——Quick Start
  9. appStore应用发布流程
  10. 关于css里的class和id
  11. 由于问题引起信号ORA-27154无法启动数据库
  12. DHCP源码分析--主流程
  13. Netty SSL安全配置
  14. .net捕捉全局未处理异常的3种方式
  15. 【原创】USART异步模式配置
  16. 纯CSS3超酷3D旋转立方体动画特效
  17. lxml xpath 爬取并正常显示中文内容
  18. PCA降维实验代码
  19. &lt;6&gt;Cocos Creator​​​​​​​调试
  20. LeetCode: Binary Tree Postorder Traversal 解题报告

热门文章

  1. flexviewer infowindow背景问题
  2. CentOS 附加软件包
  3. Microsoft Office -&gt;&gt; 完整卸载Office 2007
  4. 【NLP_Stanford课堂】文本分类1
  5. linux 下apche无法监听端口解决办法(Permission denied: make_sock: could not bind to address)
  6. 音乐播放插件Aplayer+WebAPI的使用【附下载】
  7. Angular4 微信的坑
  8. Excel Events
  9. Java导出Highcharts需要的3个外部jar包
  10. springmvc常用注解标签详解(转载)