Asp.net core 学习笔记 2.1 升级到 2.2
首先跟着官网 step by step
https://docs.microsoft.com/en-us/aspnet/core/migration/21-to-22?view=aspnetcore-2.2&tabs=visual-studio
Bug 1
发现一个 odata routing issue
https://github.com/Microsoft/aspnet-api-versioning/issues/361
因为 2.2 router 有升级, 貌似 odata 没有跟上.
https://blogs.msdn.microsoft.com/webdev/2018/08/27/asp-net-core-2-2-0-preview1-endpoint-routing/
目前只好先关上它
options.EnableEndpointRouting = false;
然后继续追踪
https://github.com/OData/WebApi/issues/1707
Bug 2
https://github.com/aspnet/AspNetCore/issues/6166
在做 webapi 又跨域的情况下, 游览器会发送 option request , 然而因为 2.2 有对 http2 之类的升级, 好像导致了 iis 的返回有点问题.
具体原因我就不管了. 反正就是用 work around 顶一顶先.
app.Use(async (ctx, next) =>
{
await next();
if (ctx.Response.StatusCode == )
{
ctx.Response.ContentLength = ;
}
});
持续追踪 https://github.com/aspnet/AspNetCore/issues/4398
Bug 3
serilog-extensions-logging-file 好像不能用了...虽然这东西本来就没有维护了.
那就找替代吧.
https://andrewlock.net/creating-a-rolling-file-logging-provider-for-asp-net-core-2-0/
https://nblumhardt.com/2017/08/use-serilog/
https://github.com/serilog/serilog-settings-configuration
https://stackoverflow.com/questions/40880261/configuring-serilog-rollingfile-with-appsettings-json
https://nblumhardt.com/2016/03/reading-logger-configuration-from-appsettings-json/
https://github.com/serilog/serilog-aspnetcore
https://github.com/serilog/serilog-sinks-file
appsetting.json
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning",
"Hangfire": "Warning"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "Log/log.txt",
"rollingInterval": 3
}
}
]
},
main.cs
public static void Main(string[] args)
{
CurrentDirectoryHelpers.SetCurrentDirectory();
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", optional: true)
.AddEnvironmentVariables()
.Build(); Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger(); WebHost.CreateDefaultBuilder(args)
.UseUrls("http://192.168.1.152:61547")
.ConfigureSecretFromCloud(skipInDevelopmentMode: true)
.UseSerilog()
.UseStartup<Startup>().Build().Run();
}
替代方案很简单. 但是 2.2 有 bug !
https://github.com/aspnet/AspNetCore/issues/4206
因为 serilog 是在 main.cs 去获取 appsetting.json 然后 setup config 的. 而 2.2 iis 情况下有一个叫 In-Progress 的鬼.
它会把 path 给弄不清楚. 幸好微软团队及时给了 work around 参考上面的 gitHub, 对话下方就有 word around 了.
Asp.net core 学习笔记 2.1 升级到 2.2的更多相关文章
- Asp.Net Core学习笔记:入门篇
Asp.Net Core 学习 基于.Net Core 2.2版本的学习笔记. 常识 像Django那样自动检查代码更新,自动重载服务器(太方便了) dotnet watch run 托管设置 设置项 ...
- ASP.NET Core 学习笔记 第一篇 ASP.NET Core初探
前言 因为工作原因博客断断续续更新,其实在很早以前就有想法做一套关于ASP.NET CORE整体学习度路线,整体来说国内的环境的.NET生态环境还是相对比较严峻的,但是干一行爱一行,还是希望更多人加入 ...
- Asp.net Core学习笔记
之前记在github上的,现在搬运过来 变化还是很大的,感觉和Nodejs有点类似,比如中间件的使用 ,努力学习ing... 优点 不依赖IIS 开源和跨平台 中间件支持 性能优化 无所不在的依赖注入 ...
- ASP.NET Core 学习笔记 第三篇 依赖注入框架的使用
前言 首先感谢小可爱门的支持,写了这个系列的第二篇后,得到了好多人的鼓励,也更加坚定我把这个系列写完的决心,也能更好的督促自己的学习,分享自己的学习成果.还记得上篇文章中最后提及到,假如服务越来越多怎 ...
- ASP.NET Core 学习笔记 第四篇 ASP.NET Core 中的配置
前言 说道配置文件,基本大多数软件为了扩展性.灵活性都会涉及到配置文件,比如之前常见的app.config和web.config.然后再说.NET Core,很多都发生了变化.总体的来说技术在进步,新 ...
- ASP.NET Core 学习笔记 第五篇 ASP.NET Core 中的选项
前言 还记得上一篇文章中所说的配置吗?本篇文章算是上一篇的延续吧.在 .NET Core 中读取配置文件大多数会为配置选项绑定一个POCO(Plain Old CLR Object)对象,并通过依赖注 ...
- Asp.net core 学习笔记 ( Data protection )
参考 : http://www.cnblogs.com/xishuai/p/aspnet-5-identity-part-one.html http://cnblogs.com/xishuai/p/a ...
- Asp.net core 学习笔记 SignalR
refer : https://kimsereyblog.blogspot.com/2018/07/signalr-with-asp-net-core.html https://github.com/ ...
- Asp.net core (学习笔记 路由和语言 route & language)
https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/routing?view=aspnetcore-2.1 https://doc ...
随机推荐
- 【转】AngularJS动态生成div的ID
AngularJS动态生成div的ID 原文链接:http://blog.csdn.net/you23hai45/article/details/52348078 1.问题背景 给定一个数组对象,里面 ...
- UI自动化框架——构建思维
目的:从Excel中获取列的值,传输到页面 技巧:尽可能的提高方法的重用率 Java包: 1.java.core包 3个类:1)日志(LogEventListener)扩展web driver自带的事 ...
- python基础之 初识函数&函数进阶
函数基础部分 1.什么是函数? 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段.函数能提高应用的模块性,和代码的重复利用率. 2.定义函数 定义:def 关键词开头,空格之后接函数名 ...
- [py]js前端求和与flask后端求和
index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...
- autoMapper的介绍
.NET的DTO映射工具AutoMapper 分类: 多层架构 DTO .NET2012-08-11 10:27 2466人阅读 评论(0) 收藏 举报 原文:https://github.com/A ...
- CentOS 7 nginx+tomcat9 session处理方案之session复制
我们的目标是所有服务器上都要保持用户的Session,那么将每个应用服务器中的Session信息复制到其它服务器节点上是不是就可以呢? 这就是Session的第二中处理办法:会话复制 192.168. ...
- P1605 迷宫
P1605 迷宫 这是一道毒瘤题... 这是一道广搜题 bfs ... 代码: #include<cstdio> #include<iostream> #include< ...
- VMware中为Linux安装vm-tools
1.虚拟机中选择安装VMware-tools,或者重新安装 2.在/mnt目录下建立cdrom文件夹 mkdir /mnt.cdrom 3.把/dev/cdrom光驱挂载到刚才建的文件夹上 mount ...
- IDEA设置(含永久破解IDEA)
永久破解IDEA(很多license服务器都是非永久性的,太麻烦了) https://www.cnblogs.com/iathanasy/p/9469280.html,亲测. 在我们为 IDEA 等编 ...
- ubuntu kylin18 安装NVIDIA驱动
这几天装系统快被折腾死了,事情的起因是这样的. 这件事情发生之前那两天一直在调试oled屏幕.我自己做转接板,1.3寸30针fpc的接口. 由于没有使用fpc专用转接座子,导致焊接特别困难,索性最后牺 ...