小编Jro*_*row的帖子

通过apache代理推送到自定义注册表时,Blob未知

我有一个自定义docker注册表运行在绑定到localhost的容器中,如下所示127.0.0.1:5010->5000/tcp。当我将图像推送到本地时,它可以工作。当我尝试将图像远程推送到它时,它会连接并开始推送图像,然后得到提示err.code="blob unknown"。该注册表通过Apache代理,并在Apache中启用了ssl。TLS在注册表中不存在,因为它绑定到本地主机,实际上并不需要它。不知道这里有什么坏事,有什么建议吗?

命令(docker login成功后):

ubuntu@ip-172-31-31-137 ? ~ ? docker push registry.sniftershifter.com/nginx
The push refers to repository [registry.sniftershifter.com/nginx]
f12c6cf07176: Pushing [==================================================>]  3.584kB
341dde1390a8: Pushing [===================>                               ]  20.87MB/53.68MB
9c46f426bcb7: Pushing [====>                                              ]  5.394MB/55.29MB
unknown blob
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

registry:
  container_name: registry
  restart: always
  image: registry:2
  ports:
    - 127.0.0.1:5010:5000
  environment:
    REGISTRY_AUTH: htpasswd
    REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
    REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
  volumes:
    - /home/jrow/docker_registry/data:/var/lib/registry
    - /home/jrow/docker_registry/auth:/auth
Run Code Online (Sandbox Code Playgroud)

Apache配置:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin email@test.com
    ServerName registry.sniftershifter.com
    ProxyPreserveHost On
    # setup the proxy
    <Proxy *> …
Run Code Online (Sandbox Code Playgroud)

docker docker-registry

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

使用FLURL从json解析为对象

我正在使用FLURL从TVDB api获取JSON响应.

我有这个课(现在愚蠢,试图获取seriesNames):

public class Show
{
    public string seriesName;
}
Run Code Online (Sandbox Code Playgroud)

而我正在使用这样的FLURL:

dynamic test = await "https://api.thetvdb.com/search/series?name=battlestar"
            .WithHeader("Accept", "application/json")
            .WithHeader("Authorization", " Bearer " + token.token)                
            .GetAsync()                
            .ReceiveJson<List<Show>>();
Run Code Online (Sandbox Code Playgroud)

我猜它没有正确地将JSON映射到对象,因为JSON中的"数据"键或者它可能无法将其直接解析为List<>?我不确定如何映射这个.我想要的结果将是一个List<Show>Show小号含有seriesName = "Battlestar Galactica: Blood & Chrome",seriesName = "Battlestar Galactica (2003)"等等,等等.

{
  "data": [
    {
      "aliases": [
        "Blood & Chrome",
        "Blood and Chrome"
      ],
      "banner": "graphical/204781-g.jpg",
      "firstAired": "2012-11-09",
      "id": 204781,
      "network": "YouTube",
      "overview": "Battlestar: Blood & Chrome takes place in the 10th year …
Run Code Online (Sandbox Code Playgroud)

c# json flurl

4
推荐指数
1
解决办法
3825
查看次数

WPF使用语句打开另一个表单

我在Winforms中编写了一个C#应用程序,现在我在WPF中重写它.在Winforms版本中,我使用以下内容打开另一个窗口,同时向其发送信息并从中接收信息:

using (showSelection showSelection1 = new showSelection(listBox2.SelectedItem.ToString()))
            {
                showSelection1.ShowDialog();               
                storage1.showID = showSelection1.showID;
                storage1.numOfSeasons = showSelection1.numOfSeasons;

            }
Run Code Online (Sandbox Code Playgroud)

这工作正常,我从showSelection表单中发送listBox2并接收showIDnumOfSeasons使用此代码:

this.showID = Convert.ToInt32(dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value);
this.numOfSeasons = dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();
this.Close();
Run Code Online (Sandbox Code Playgroud)

现在,在WPF版本中我尝试了同样的事情:

using (ShowSelection showSelection = new ShowSelection(showListBox.SelectedItem.ToString()))
            {

            }
Run Code Online (Sandbox Code Playgroud)

但在里面using( )我得到这个错误: ShowSelection: type used in a using statement must be implicitly convertible to 'System.IDisposable'

我不确定从这里做什么.我可以解决这个问题并且仍然以同样的方式解决这个问题,或者我应该采用不同的方式做到这一点吗?ShowSelection窗口只是一个带有单个按钮的数据网格.

c# wpf winforms

3
推荐指数
1
解决办法
655
查看次数

ASP .NET Core使用多个CORS策略

我正在尝试设置2个CORS策略.一个作为api默认值,另一个Controllers作为我需要它们使用.我想这样做的原因是因为我有一个端点,它接收带有电子邮件信息的对象并发送电子邮件(与我的网页上的"联系我"框一起使用)并让它只接受来自我的域的请求.

我的startup.cs文件片段:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("Example",
                    builder => builder.WithOrigins("http://www.example.com"));
                options.AddPolicy("AllowAll",
                    builder => builder.AllowAnyOrigin());
            });

            services.AddMvc();
            //other configure stuff
        }


 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        app.UseCors(builder =>
        {
            builder.AllowAnyHeader();
            builder.AllowAnyMethod();
            builder.WithOrigins("AllowAll");
        });

        app.UseMvcWithDefaultRoute();
    }
Run Code Online (Sandbox Code Playgroud)

我的emailcontroller.cs档案:

using System.Threading.Tasks;
using MyAPI.Models;
using MyAPI.Services;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;

namespace MyAPI.Controllers
{
    [Produces("application/json")]
    [Route("api/Email")]
    [EnableCors("Example")]
    public class EmailController : Controller
    {
        private readonly IEmailSender _emailSender;

        public EmailController(IEmailSender emailSender)
        {
            _emailSender …
Run Code Online (Sandbox Code Playgroud)

.net javascript c# cors asp.net-core

3
推荐指数
2
解决办法
3168
查看次数

EF Core至Mysql表绑定

我在MySQL中有下表 在此处输入图片说明

当我在某些中间件中运行以下代码时

var apiKeys = _appContext.apikey.ToList();
Run Code Online (Sandbox Code Playgroud)

我得到这个错误

System.InvalidOperationException:类型'System.Int16'和'System.Boolean'之间没有定义强制运算符。

这是我的ApiKey类

public class ApiKey
{
    public string apikeyid { get; set; }
    public string uid { get; set; }
    public string apikey { get; set; }
    public bool isactive { get; set;}
    public bool ispaid { get; set; }
    public bool ismod { get; set; }
    public bool isadmin { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我曾与Postgresql db一起工作过,然后才移到MySQL。这与从tinyint(在数据库中)到bool(在类中)有关吗?

我正在使用 MySql.Data.EntityFrameworkCore 8.0.13

c# mysql .net-core ef-core-2.1

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