C# 我应该如何解决以下错误消息?(111)连接被拒绝:AH00957:HTTPS:尝试连接到127.0.0.1:5001(127.0.0.1)失败
如前所述,我在apache日志中收到以下错误消息C# 我应该如何解决以下错误消息?(111)连接被拒绝:AH00957:HTTPS:尝试连接到127.0.0.1:5001(127.0.0.1)失败,c#,apache,asp.net-core,amazon-ec2,aws-codestar,C#,Apache,Asp.net Core,Amazon Ec2,Aws Codestar,如前所述,我在apache日志中收到以下错误消息 [Sat Jun 22 12:57:53.746190 2019] [proxy:error] [pid 10299:tid 140435221571328] (111)Connection refused: AH00957: HTTPS: attempt to connect to 127.0.0.1:5001 (127.0.0.1) failed [Sat Jun 22 12:57:53.746228 2019] [proxy:error]
[Sat Jun 22 12:57:53.746190 2019] [proxy:error] [pid 10299:tid 140435221571328] (111)Connection refused: AH00957: HTTPS: attempt to connect to 127.0.0.1:5001 (127.0.0.1) failed
[Sat Jun 22 12:57:53.746228 2019] [proxy:error] [pid 10299:tid 140435221571328] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Sat Jun 22 12:57:53.746233 2019] [proxy_http:error] [pid 10299:tid 140435221571328] [client myip:65168] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
使用代码pipline部署时,我看不到任何错误消息
我已经尝试了以下所有方法
- 重新启动并重建我的应用程序
- 在我的ASP项目中调整launchSettings.json文件李>
- 在我的程序类中调整端口并启用/禁用HTTPS重定向李>
- 在apache中调整我的vhsosts文件
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44335",
"sslPort": 44335
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_My_Environment": "1",
"ASPNETCORE_DETAILEDERRORS": "1",
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ProjectName": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}
/etc/apache2/sites enabled/000-default.conf
代理主机
代理过程“/”http://127.0.0.1:5000/"
ProxyPassReverse“/”http://127.0.0.1:5000/"
/etc/apache2/sites enabled/000-default-le-ssl.conf
斯伦金安
SSLProxyEngine打开
代理主机
代理过程“/”https://127.0.0.1:5001/"
ProxyPassReverse“/”https://127.0.0.1:5001/"
ServerName mydomain.com
Include/etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile/etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile/etc/letsencrypt/live/mydomain.com/privkey.pem
镫骨肌
public void配置服务(IServiceCollection服务)
{
var logger=_loggerFactory.CreateLogger();
logger.LogInformation($“环境:{u env.EnvironmentName}”);
//开发服务配置
如果(_env.IsDevelopment())
{
logger.LogInformation(“开发环境”);
配置(选项=>
{
options.KnownProxies.Add(IPAddress.Parse(“127.0.0.1”);
});
services.AddHttpsRedirection(选项=>
{
options.RedirectStatusCode=StatusCodes.Status307TemporaryRedirect;
options.HttpsPort=44335;
});
}
//实时服务配置
如果(!\u环境开发())
{
services.AddHttpsRedirection(选项=>
{
options.RedirectStatusCode=StatusCodes.Status308Direct;
options.HttpsPort=5001;
});
配置(选项=>
{
options.KnownProxies.Add(IPAddress.Parse(“127.0.0.1”);
});
services.AddHsts(选项=>
{
options.Preload=true;
options.IncludeSubDomains=true;
options.MaxAge=TimeSpan.FromDays(60);
});
}
//为庆祝节日而移除的线路。
}
公共无效配置(IApplicationBuilder应用程序,IHostingEnvironment环境)
{
//开发环境
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
}
if(env.IsProduction())
{
app.UseExceptionHandler(“/Home/Error”);
app.UseHsts();
app.UseForwardedHeaders(新ForwardedHeaders选项
{
ForwardedHeaders=ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
}
app.UseHttpsRedirection();
//为庆祝节日而移除的线路。
}
如果你需要更多的信息,请告诉我
编辑:服务器:EC2 Ubuntu(通过Code Star构建),Web服务:Apache,项目代码:asp.net core 2.1,SSL证书:LetsEncrypt,代理:不是100%确定。尝试以下代码,使HTTPD脚本和模块能够连接到网络
/usr/sbin/setsebool -P httpd_can_network_connect 1
如果它无法在端口5001上连接到自身(127.0.0.1),可能只是端口5001没有侦听请求?是否存在与端口5001关联的应用程序?它在运行吗?您是否将操作系统配置为允许连接到5001?因此,我打开了ports.conf,应用程序被设置为侦听5000,然后https重定向到5001。当你说os时,我不知道你的意思是什么?EC2安全组允许80和443通信量,当导航到域时,这可以正常工作,ssl也可以工作,但是我遇到了503错误消息,也看到了上面提到的错误消息。OS,操作系统。如果您的安全组允许80和443,那么不应该也允许5000和5001吗?我不是EC2专家,我不知道安全组是否适用于自身的连接。。。