小编Kha*_*lil的帖子

HNS失败并显示错误:参数不正确

我正在使用visual studio 2017制作一个docker容器化应用程序.当首先通过visual studio运行docker时,我收到错误"ERROR:客户端版本1.22太旧".

通过将docker compose更新到2.1版来解决此错误

以下链接包含有关此特定错误的进一步说明

错误:客户端版本1.22太旧了

解决此错误后,现在在On Building docker上出现"HNS因错误而失败:参数不正确".

从多个github讨论中我发现它是一个Windows网络错误.

有这个问题的解决方案吗?我应该降低docker版本或安装别的东西.

我正在使用Windows容器.在运行docker版本Client:Version:17.06.0-ce API version:1.30 Go version:go1.8.3 Git commit:02c1d87 Built:Fri Jun 23 21:30:30 2017 OS/Arch:windows/amd64

服务器:版本:17.06.0-ce API版本:1.30(最低版本1.24)Go版本:go1.8.3 Git commit:02c1d87 Built:Fri Jun 23 22:19:00 2017 OS/Arch:windows/amd64实验:true

编辑:

如果我切换到linux容器,这个问题就解决了.但另一个问题是驱动器不共享.共享d后:仍然会出现驱动器共享问题.

如何解决Linux容器驱动器共享问题.

我想在本地使用Windows容器,以便我可以在azure上部署此应用程序.

docker docker-compose windows-container

10
推荐指数
2
解决办法
5309
查看次数

Class <的语法是什么?在Kotlin中扩展class_name>?

我试图使一个Arraylist接受从Word_Class继承的任何类变量,但它不起作用:

var lst = ArrayList<Class<Word_Class>>();
lst.add(Class<Noun_Class>);
Run Code Online (Sandbox Code Playgroud)

我正在寻找Class <的语法。在Kotlin中扩展class_name>  

class kotlin

8
推荐指数
1
解决办法
1820
查看次数

System.Text.Json 将空字符串全局序列化为空字符串

将代码从 newtonsoft json 迁移到 system.text.json 时

我需要所有可为空的字符串呈现为空字符串。

我编写了以下转换器,但所有空字符串值仍呈现为空。

对于空字符串值,不会调用 Write 方法。断点永远不会被击中。

public class EmptyStringConverter : JsonConverter<string>
{
    public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        => Convert.ToString(reader.GetString(), CultureInfo.CurrentCulture);

    public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
    {
        if (writer == null)
            throw new ArgumentNullException(nameof(writer));
        writer.WriteStringValue(value ?? "");
    }
}
Run Code Online (Sandbox Code Playgroud)

启动代码

services.AddControllers()
    .AddJsonOptions(option =>
    {
        option.JsonSerializerOptions.Converters.Add(new EmptyStringConverter());
    });
Run Code Online (Sandbox Code Playgroud)

控制台示例

class Program
{
    static void Main(string[] args)
    {
        var jsonSerializerOptions = new JsonSerializerOptions();
        jsonSerializerOptions.Converters.Add(new EmptyStringConverter());
        var json = JsonSerializer.Serialize(new …
Run Code Online (Sandbox Code Playgroud)

c# .net-core system.text.json

5
推荐指数
1
解决办法
8309
查看次数