【问题标题】:Running dotnet microservice on http://localhost:5000/api/Values throws This site can’t be reached localhost refused to connect在 http://localhost:5000/api/Values 上运行 dotnet 微服务会抛出无法访问此站点 localhost 拒绝连接
【发布时间】:2019-09-24 14:24:05
【问题描述】:

我就是这样用的

Amreshs-MacBook-Air:myMicroservice amresh$ dotnet run
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /Users/amresh/myMicroservice

抛出错误

找不到这个本地主机页面没有找到该网址的网页:http://localhost:5000/

在 Google 上搜索 localhost 5000 HTTP 错误 404

使用创建的项目

https://dotnet.microsoft.com/learn/aspnet/microservice-tutorial/create

【问题讨论】:

  • 你在做http://localhost:5000/api/Values 还是http://localhost:5000/
  • 两者都出现同样的问题,@Matthew

标签: .net-core microservices asp.net-core-webapi


【解决方案1】:

看起来在 3.0 预览模板中引入了对示例应用程序的更新。 dotnet run 应该仍然可以工作,但您需要在浏览器中输入 http://localhost:5000/WeatherForecast 才能查看服务的输出。

他们必须决定如何更新样本。

【讨论】:

    猜你喜欢
    • 2017-04-04
    • 2019-03-31
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 2021-12-29
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多