Skip to content
This repository was archived by the owner on Aug 20, 2022. It is now read-only.
This repository was archived by the owner on Aug 20, 2022. It is now read-only.

Failed to connect to sqlserver while running eshopondapr using bridge to k8s  #244

@starryrbs

Description

@starryrbs

Describe the bug
A clear and concise description of what the bug is.

Failed to connect to sqlserver while running eshopondapr using bridge to k8s.
The following error was encountered.

[15:23:42 FTL] Host terminated unexpectedly (Catalog.API)...
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
---> System.ComponentModel.Win32Exception (53): 找不到网络路径。

To Reproduce
Steps to follow to reproduce this issue.

clone code

git clone https://github.com/dotnet-architecture/eShopOnContainers

Deploy applications in the K8S cluster

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Catalog API Launch (web) with Kubernetes",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "bridge-to-kubernetes.compound",
            "program": "${workspaceFolder}/src/Services/Catalog/Catalog.API/bin/Debug/netcoreapp5.0/Catalog.API.dll",
            "args": [],
            "cwd": "${workspaceFolder}/src/Services/Catalog/Catalog.API",
            "stopAtEntry": false,
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development",
                "ASPNETCORE_URLS": "http://+:3001"
            },
            "sourceFileMap": {
                "/Views": "${workspaceFolder}/Views"
            }
        },]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "bridge-to-kubernetes.resource",
            "type": "bridge-to-kubernetes.resource",
            "resource": "catalog-api",
            "resourceType": "service",
            "ports": [
                3500
            ],
            "targetCluster": "kubernetes",
            "targetNamespace": "eshopondapr",
            "useKubernetesServiceEnvironmentVariables": false
        },
        {
            "label": "bridge-to-kubernetes.compound",
            "dependsOn": [
                "bridge-to-kubernetes.resource",
                "build"
            ],
            "dependsOrder": "sequence"
        }
    ]
}

Run Catalog API Launch (web) with Kubernetes

Expected behavior
A clear and concise description of what you expected to happen.

Logs
Attach logs from the following directory:
For Windows: %TEMP%/Bridge to Kubernetes
For OSX/Linux: $TMPDIR/Bridge to Kubernetes
If you are a Visual Studio user,

  • Set the environment variable MS_VS_AZUREDEVSPACES_TOOLS_LOGGING_ENABLED=true
  • Open Visual Studio and run your scenario
  • Provide logs from: %temp%\Microsoft.VisualStudio.Kubernetes.Debugging

Environment Details
Client used (VS Code/Visual Studio):

Client's version:
Operating System:

Additional context
Add any other outputs from the clients or context you would like to share.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions