.NET Core 3.0 Preview 6 已发布,其中包括用于编译程序集的更新,以改进启动性能,以及通过对链接器和 EventPipe 的改进来优化应用程序的大小。
此外,.NET Core 团队还为 Alpine on ARM64 发布了新的 Docker 镜像。
下载地址:https://dotnet.microsoft.com/download/dotnet-core/3.0(支持 Windows, macOS 和 Linux)
WPF 团队现已将大部分的 WPF 代码库托管至 GitHub。实际上,他们刚刚发布了 15 个组件的源代码。对于熟悉 WPF 的开发者来说,这些程序集名称应该非常熟悉。
Docker 镜像现在可用于 ARM64 上的 .NET Core 和 ASP.NET Core,它们之前只适用于 x64 平台。
以下的镜像可用于Dockerfile
, 如下所示使用docker pull
的方式即可:
- docker pull mcr.microsoft.com/dotnet/core/runtime:3.0-alpine-arm64v8
- docker pull mcr.microsoft.com/dotnet/core/aspnet:3.0-alpine-arm64v8
HTTP/2 是 HTTP 协议的主要修订版。.NET Core 3.0 的HttpClient
现已添加对 HTTP/2 请求的支持。虽然默认值仍为 HTTP/1.1,但我们可以通过在 HTTP 请求消息上设置版本来选择使用 HTTP/2。
var client = new HttpClient() { BaseAddress = new Uri("https://localhost:5001") };// HTTP/1.1 request using (var response = await client.GetAsync("/"))
{
Console.WriteLine(response.Content);
}// HTTP/2 request using (var request = new HttpRequestMessage(HttpMethod.Get, "/") { Version = new Version(2, 0) })using (var response = await client.SendAsync(request))
{
Console.WriteLine(response.Content);
}
或者可以通过设置DefaultRequestVersion
属性以在HttpClient
中默认发送 HTTP/2 请求。
var client = new HttpClient()
{
BaseAddress = new Uri("https://localhost:5001"),
DefaultRequestVersion = new Version(2, 0)
};// Defaults to HTTP/2 using (var response = await client.GetAsync("/"))
{
Console.WriteLine(response.Content);
}
其他更新还包括对事件管道的改进、使用 ReadyToRun 镜像优化 .NET Core 应用程序以及针对跨平台/跨架构编译的改进。详情请查看发布公告。
(文/开源中国)