小编Kev*_*inG的帖子

Git,致命:远程端意外挂断

当我试图跑

git push origin master --force
Run Code Online (Sandbox Code Playgroud)

我刚得到

Counting objects: 2649, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1280/1280), done.
error: RPC failed; result=22, HTTP code = 413 | 116 KiB/s   
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2504/2504), 449.61 MiB | 4.19 MiB/s, done.
Total 2504 (delta 1309), reused 2242 (delta 1216)
fatal: The remote end hung up unexpectedly
Everything up-to-date
Run Code Online (Sandbox Code Playgroud)

这与不安全有关吗?我尝试在Fatal的答案中创建一个公钥:远程端意外挂断并再次运行它,但它仍然无法正常工作.我实际上没有使用钥匙吗?如果是这样,我该如何使用它?

git github

250
推荐指数
17
解决办法
44万
查看次数

断言对mock方法的连续调用

模拟有一个有用的assert_called_with()方法.但是,据我所知,这只检查最后一次调用方法.
如果我有连续3次调用模拟方法的代码,每次使用不同的参数,我如何用它们的特定参数断言这3个调用?

python mocking

141
推荐指数
4
解决办法
8万
查看次数

使用依赖项注入的自定义NLog LayoutRenderer与构造函数

我正在尝试编写一个自定义LayoutRenderer来记录从对象读取的数据,但是NLog似乎不能与依赖注入一起正常工作。

这是我的CustomLayoutRenderer:

[LayoutRenderer("custom-value")]
public class CustomLayoutRenderer : LayoutRenderer
{
    private readonly RequestContext _context;

    public CustomLayoutRenderer(RequestContext context)
    {
        _context = context;
    }

    protected override void Append(StringBuilder builder, LogEventInfo logEvent)
    {
        builder.Append(_context.CustomValue);
    }
}
Run Code Online (Sandbox Code Playgroud)

它正在使用此RequestContext对象:

public class RequestContext
{
    public string CustomValue { get; set; } = "Valid custom value";
}
Run Code Online (Sandbox Code Playgroud)

我还在连接DI,配置NLog并在Startup.cs中注册我的LayoutRenderer:

    public void ConfigureServices(IServiceCollection services)
    {
        // ...
        services.AddScoped<RequestContext>();
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        LayoutRenderer.Register<CustomLayoutRenderer>("custom-value");

        loggerFactory.AddNLog();
        app.AddNLogWeb();
        env.ConfigureNLog("nlog.config");
        // ...
    }
Run Code Online (Sandbox Code Playgroud)

然后,我尝试${custom-value}在nlog.config中使用我的设备,但是在AddNLog()通话中出现错误: …

c# nlog asp.net-core

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

标签 统计

asp.net-core ×1

c# ×1

git ×1

github ×1

mocking ×1

nlog ×1

python ×1