小编Ed *_*005的帖子

无法连接到 Docker 中托管的 net core gRPC 服务

我对 gRPC 服务比较陌生。

我正在尝试将Net core gRPC 服务部署到 Linux docker 容器中,并从VS 控制台应用程序本地访问它。

我想让事情尽可能简单,因此 docker 文件与 VS 中 docker compose 指向它的 Net core gRPC docker 文件相同。当直接在VS中运行gRPC服务时,控制台应用程序可以访问该服务,只是不能在docker容器中访问。

gRPC 启动设置

{
  "profiles": {
    "TrafficGrpc": {
      "commandName": "Project",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001"
    },
    "Docker": {
      "commandName": "Docker",
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "publishAllPorts": true,
      "useSSL": true
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

gRPC 应用程序设置

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "Kestrel": {
    "EndpointDefaults": {
      "Protocols": …
Run Code Online (Sandbox Code Playgroud)

c# docker .net-core grpc

6
推荐指数
1
解决办法
5634
查看次数

在 ASP Net Core 中向表添加可点击行

ASP.NET CORE
我有一个表,我希望该行可单击,从而将用户带入详细信息页面。该行应有一个链接,调用带有报告 ID 的名为“Detail”的控制器操作。

我已经尝试过这个答案,但它不起作用。
asp.net mvc 3 剃刀。导航到表 tr 单击查看

请帮忙。

<thead>
    <tr>
        <th class="col-sm-2">
            @Html.DisplayName("Report ID")
        </th>
        <th class="col-sm-3">
            @Html.DisplayName("Action")
        </th>
    </tr>
</thead>

@foreach (var item in Model.MyList)
{
    <tr onclick="location.href='@Url.ActionLink("Detail", "ReportController", new { Id = item.ID })'">
        <td>
            @Html.DisplayFor(modelItem => item.ID)
        </td>
        <td>
            @Html.ActionLink("Download", "Download", new { id = item.ID })
        </td>
    </tr>
}
Run Code Online (Sandbox Code Playgroud)

asp.net-core

2
推荐指数
1
解决办法
4472
查看次数

标签 统计

.net-core ×1

asp.net-core ×1

c# ×1

docker ×1

grpc ×1