我有一个自定义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) 我正在使用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) 我在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并接收showID并numOfSeasons使用此代码:
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窗口只是一个带有单个按钮的数据网格.
我正在尝试设置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) 当我在某些中间件中运行以下代码时
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# ×4
.net ×1
.net-core ×1
asp.net-core ×1
cors ×1
docker ×1
ef-core-2.1 ×1
flurl ×1
javascript ×1
json ×1
mysql ×1
winforms ×1
wpf ×1