【问题标题】:The username or password is incorrect when launching Docker from Visual Studio 2019从 Visual Studio 2019 启动 Docker 时用户名或密码不正确
【发布时间】:2021-08-15 05:29:55
【问题描述】:

所以,我对 Docker 非常陌生,我正在尝试使用它来容器化 ASP.NET(框架 4.7.2)应用程序。我的平台是 Windows 10,应用程序将在 Windows 容器下运行。这是我所做的:

  1. 在 Visual Studio 中右键单击项目时单击“添加 -> Docker 支持...”。
  2. 等待它生成 Dockerfile。
  3. 点击“运行”。

Chrome 启动时会弹出一个通用的 500 IIS 错误,它在 IP 172.26.102.145 而不是 localhost:port 处打开,就像在没有 Docker 的情况下运行时一样。我查看了事件日志,这就是我所看到的:

exec's CreateProcess() failed [module=libcontainerd exec=9c32d86647bc2b4b4207c447f15433d06603297dd01513445405b7841e9aa64c container=fbe41e9f4206b4b8ba3c789c7e0514e313589182e90c36e0a71b7d6cd74e17e5 namespace=moby error=container fbe41e9f4206b4b8ba3c789c7e0514e313589182e90c36e0a71b7d6cd74e17e5 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The user name or password is incorrect. (0x52e)
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF7FF789F4B: (caller: 00007FF7FF73E13A) Exception(4) tid(4c0) 8007052E The user name or password is incorrect.
    CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess] 
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"cmd.exe /C \"ECHO 192.168.1.71    host.docker.internal \u003e\u003e %systemroot%\\system32\\drivers\\etc\\hosts \u0026 ECHO 192.168.1.71    gateway.docker.internal \u003e\u003e %systemroot%\\system32\\drivers\\etc\\hosts\"","User":"Administrator","WorkingDirectory":"C:\\inetpub\\wwwroot","Environment":{"COMPLUS_ForceENC":"1","COMPLUS_NGenProtectedProcess_FeatureEnabled":"0","DEV_ENVIRONMENT":"1","ROSLYN_COMPILER_LOCATION":"C:\\RoslynCompilers\\tools","VBCSCOMPILER_TTL":"604800"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}]

我在其他地方读到问题可能是因为 IP?我在 Powershell 中运行了以下命令,以获取我认为可行的另一个命令:

docker inspect <container_id>

但“Networks/nat/IPAddress”下的 IP 相同。

我还尝试禁用防火墙/防病毒软件以及在 Docker Desktop 上登录我的帐户。我不确定我应该验证什么,我的 Microsoft 登录以某种方式?我觉得我犯了一个菜鸟的错误!

哦,这是我的 Dockerfile:

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat 

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

【问题讨论】:

    标签: asp.net-mvc visual-studio docker


    【解决方案1】:

    这个问题原来是一个红鲱鱼,通过查看 Docker 容器中的 IIS 应用程序日志发现了真正的问题。我建议任何面临这个问题的人通过运行在容器中打开 powershell:

    docker container exec -it &lt;container-name/id&gt; powershell

    然后浏览应用程序日志:

    Get-EventLog -LogName Application -Newest 15

    您可能会在那里看到一个问题。另外,您可以尝试在容器中运行它以查看是否有错误吐出:

    Invoke-WebRequest http://localhost

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-27
      • 2016-12-02
      • 1970-01-01
      • 2020-02-04
      • 2022-08-04
      • 2012-07-13
      相关资源
      最近更新 更多