我刚刚使用dotnet new mvc
创建了一个新项目,但是远程连接到该网页之后(我正在使用nginx实现反向代理)
有一个异常提示
dbug:HttpsConnectionAdapter [1] 无法验证HTTPS连接。 System.IO.IOException:由于意外的数据包格式,握手失败。 在System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest) ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Net.Security.SslState.ThrowIfExceptional() 在System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) 在System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult结果) 在System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult) 在System.Net.Security.SslStream。<> c.b__51_1(IAsyncResult iar) 在System.Threading.Tasks.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction,Action1 endAction, Task
1 promise,布尔值requireSynchronization处) ---从之前引发异常的位置开始的堆栈结束跟踪--- 在Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionAdapter.InnerOnConnectionAsync(ConnectionAdapterContext context)
任何人都知道可能是什么原因?
Nginx状态:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-11-24 23:35:25 CET; 6s ago
Docs: man:nginx(8)
Process: 16378 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 16383 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 16381 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 16386 (nginx)
Tasks: 2 (limit: 4915)
Memory: 2.9M
CPU: 47ms
CGroup: /system.slice/nginx.service
├─16386 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─16387 nginx: worker process
我的nginx->网站可用-> default.txt
server {
listen 80;
server_name example.com *.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.402
Commit: 3599f217f4
Runtime Environment:
OS Name: debian
OS Version: 9
OS Platform: Linux
RID: debian.9-x64
Base Path: /usr/share/dotnet/sdk/2.1.402/
Host (useful for support):
Version: 2.1.4
Commit: 85255dde3e
.NET Core SDKs installed:
2.1.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore. All]
Microsoft.AspNetCore.App 2.1.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore. App]
Microsoft.NETCore.App 2.1.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
答案 0 :(得分:0)
解决方案:
在其他文件nginx站点文件:sites-enabled/default
中,我使用了此配置:
server {
listen 80;
server_name example.com *.example.com;
location / {
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
解决方案是将端口5001更改为5000