我编写了一个简单的Asp.Net Core WebAPI 2.0应用程序,它可以在我的本地计算机上运行. 但我想将其部署到服务器. 所以,我做到了.
I write simple Asp.Net Core WebAPI 2.0 application, it works on my local machine. But i want to deploy it to server. So, i do it.
我的系统:
Ubuntu 16.04. Asp.Net WebAPI 2.0 (and dotnet version 2.1.105)但是,当应用启动时,它会写:
But, when app starts it writes:
Now listening on:localhost:53115当我尝试从中获取价值时:
When i try to get values from it:
id_address:53115/api/values我无法得到回应. 在邮递员中:
And i can not get response. In Postman:
Could not get any response There was an error connecting to id_address:53115/api/values. Why this might have happened: The server couldn't send a response: Ensure that the backend is working properly Self-signed SSL certificates are being blocked: Fix this by turning off 'SSL certificate verification' in Settings > General Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy Request timeout: Change request timeout in Settings > General我该怎么办?你能告诉我如何解决吗?
What i should do? Can you tell me how to fix that?
我不知道从哪里开始寻找.
I do not know where to start looking for.
谢谢!
推荐答案我正在使用.NETCore 2.1 prev,所以我自己无法对其进行测试,但是如果我相信 www.billbogaiv/posts/setting-aspnet-host-address -in-net-core-2 ,添加.UseUrls(urls: "*:5000")可能指示Kestrel监听端口5000,不仅在本地主机上,因此它也应在远程服务器上工作.
I'm using .NETCore 2.1 prev, so I haven't been able to test it myself but if I believe that www.billbogaiv/posts/setting-aspnet-host-address-in-net-core-2, adding .UseUrls(urls: "*:5000") might be instructing Kestrel to listen to port 5000 and not only on localhost, so it should work also on a remote server.
其他可能的解决方案,UseKestrel(..) docs.microsoft/zh-cn/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.1&tabs=aspnetcore2x 使用IPAddress.Any而不是Loopback.
Other possible solution, UseKestrel(..) docs.microsoft/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-2.1&tabs=aspnetcore2x using IPAddress.Any instead of Loopback.
更多推荐
Asp.Net Core Web API应用程序:如何更改监听地址?
发布评论