Я с удовольствием разрабатываю веб-приложение ASP.NET CORE 2.1 и запускаю его в Visual Studio с Docker.До сих пор.
Совершенно неожиданно, когда я пытаюсь начать отладку, он выполняет сборку, но полностью пропускает работающую часть.Так что теперь я не могу отладить свой контейнер Docker с помощью Visual Studio 2017.
Ошибок не отображается, все вроде бы в порядке, за исключением того факта, что приложение не запускается.Отладка вывода даже не в списке доступных на вкладке «Вывод».Контейнер, кажется, работает, но по какой-то причине Visual Studio не присоединяется к образу Docker для отладки.
Любая помощь будет принята с благодарностью.
Перезапуск Visual Studio или компьютера, удаление bin,obj, .vs,% userprofile% \ vsdbg и% userprofile% \ onecoremsvsmon не имели никакого значения.Вот моя среда:
- Windows10
- Microsoft Visual Studio Enterprise 2017 версии 15.9.4
- VisualStudio.15.Release / 15.9.4 + 28307.222
- Языковые службы ASP.NET Core Razor 15.8.31590
- Инструменты Microsoft Visual Studio для контейнеров 1.1
- Инструменты Visual Studio для контейнеров 1.0
Докер:
- Версия 2.0.0.0-win81 (29211)
- Сборка: 4271b9e
- Двигатель: 18.09.0
- Состав: 1.23.2
- Машина: 0.16.0
Кажется, что контейнер работает:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
22852e61b41a dockertest "tail -f /dev/null" 4 minutes ago Up 4 minutes 0.0.0.0:50659->80/tcp, 0.0.0.0:44304->443/tcp priceless_pare
Dockerfile:
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["Dockertest/Dockertest.csproj", "Dockertest/"]
RUN dotnet restore "Dockertest/Dockertest.csproj"
COPY . .
WORKDIR "/src/Dockertest"
RUN dotnet build "Dockertest.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "Dockertest.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Dockertest.dll"]
Выход сборки VS:
Target ContainerPrepareForLaunch:
Using "ResolveVsDbgPath" task from assembly "C:\Users\aaaa\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.2105168\build\..\tools\Microsoft.VisualStudio.Containers.Tools.Tasks.dll".
Task "ResolveVsDbgPath"
Done executing task "ResolveVsDbgPath".
Task "ContainerError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
'@(_Dockerfile->AnyHaveMetadataValue('TargetOS', 'Linux'))' == 'true' And
!Exists('$(ContainerVsDbgPath)\vsdbg')) was evaluated as ('.NETCoreApp' == '.NETCoreApp' And
'true' == 'true' And
!Exists('C:\Users\aaaa\vsdbg\vs2017u5\vsdbg')).
Using "ResolveMsVsMonPath" task from assembly "C:\Users\aaaa\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.2105168\build\..\tools\Microsoft.VisualStudio.Containers.Tools.Tasks.dll".
Task "ResolveMsVsMonPath"
Done executing task "ResolveMsVsMonPath".
Using "PrepareForLaunch" task from assembly "C:\Users\aaaa\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.2105168\build\..\tools\Microsoft.VisualStudio.Containers.Tools.Tasks.dll".
Task "PrepareForLaunch"
docker build -f "C:\Projects\Dockertest\Dockerfile" -t dockertest --label "com.microsoft.created-by=visual-studio" "C:\Projects"
Sending build context to Docker daemon 3.007GB
Step 1/18 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
---> 1fe6774e5e9e
Step 2/18 : WORKDIR /app
---> Using cache
---> 930ee0770e2d
Step 3/18 : EXPOSE 80
---> Using cache
---> 4f184a8a4bd4
Step 4/18 : EXPOSE 443
---> Using cache
---> bdf7dc4e92fd
Step 5/18 : FROM microsoft/dotnet:2.1-sdk AS build
---> 04868b49e01f
Step 6/18 : WORKDIR /src
---> Using cache
---> c27b25a30aeb
Step 7/18 : COPY ["Dockertest/Dockertest.csproj", "Dockertest/"]
---> Using cache
---> 009cbf61e5ae
Step 8/18 : RUN dotnet restore "Dockertest/Dockertest.csproj"
---> Using cache
---> 9baf38b818c8
Step 9/18 : COPY . .
---> ae210461c587
Step 10/18 : WORKDIR "/src/Dockertest"
---> Running in 024c6719cbd3
Removing intermediate container 024c6719cbd3
---> f398384b2049
Step 11/18 : RUN dotnet build "Dockertest.csproj" -c Release -o /app
---> Running in cacc4471c224
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 57.06 ms for /src/Dockertest/Dockertest.csproj.
Dockertest -> /app/Dockertest.dll
Dockertest -> /app/Dockertest.Views.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:09.30
Removing intermediate container cacc4471c224
---> 5854863d47c7
Step 12/18 : FROM build AS publish
---> 5854863d47c7
Step 13/18 : RUN dotnet publish "Dockertest.csproj" -c Release -o /app
---> Running in 69df3a178cd7
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 67.48 ms for /src/Dockertest/Dockertest.csproj.
Dockertest -> /src/Dockertest/bin/Release/netcoreapp2.1/Dockertest.dll
Dockertest -> /src/Dockertest/bin/Release/netcoreapp2.1/Dockertest.Views.dll
Dockertest -> /app/
Removing intermediate container 69df3a178cd7
Step 14/18 : FROM base AS final
---> 766815671751
---> bdf7dc4e92fd
Step 15/18 : WORKDIR /app
---> Using cache
---> 61f28b8a64fa
Step 16/18 : COPY --from=publish /app .
---> 6b6711105d65
Step 17/18 : ENTRYPOINT ["dotnet", "Dockertest.dll"]
---> Running in f3be0a8361ee
Removing intermediate container f3be0a8361ee
---> 774100a76bc9
Step 18/18 : LABEL com.microsoft.created-by=visual-studio
---> Running in 76d649057957
Removing intermediate container 76d649057957
---> dbf49735c067
Successfully built dbf49735c067
Successfully tagged dockertest:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
docker rm -f ce37c3274e9a73fdfeb0b5cb48d451cf3fea687ee3b5c91388ecad1d1f695149
ce37c3274e9a73fdfeb0b5cb48d451cf3fea687ee3b5c91388ecad1d1f695149
docker run -dt -v "C:\Users\aaaa\vsdbg\vs2017u5:/remote_debugger:rw" -v "C:\Users\aaaa\AppData\Roaming\ASP.NET\Https:/root/.aspnet/https:ro" -v "C:\Users\aaaa\AppData\Roaming\Microsoft\UserSecrets:/root/.microsoft/usersecrets:ro" -e "ASPNETCORE_URLS=https://+:443;http://+:80" -e "ASPNETCORE_HTTPS_PORT=44304" -e "ASPNETCORE_ENVIRONMENT=Development" -p 50659:80 -p 44304:443 --entrypoint tail dockertest -f /dev/null
22852e61b41ad164632588db2b4027ad59cc5e876956fb99c7e8eadcbcfcdd77
Done executing task "PrepareForLaunch".
Target "_CheckForInvalidConfigurationAndPlatform" skipped. Previously built successfully.
Target "_CheckForInvalidConfigurationAndPlatform" skipped. Previously built successfully.
Target ReportTypeScriptVersion:
Using "FormatLocalizedString" task from assembly "C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.1\build\TypeScript.Tasks.dll".
Task "FormatLocalizedString"
Done executing task "FormatLocalizedString".
Task "FormatLocalizedString" skipped, due to false condition; ('$(TypeScriptVersionCheckResult)' == 'Downgrade' OR '$(TypeScriptVersionCheckResult)' == 'Upgrade') was evaluated as ('NoneSpecified' == 'Downgrade' OR 'NoneSpecified' == 'Upgrade').
Task "Warning" skipped, due to false condition; ('$(TypeScriptShowVersionWarning)' == 'true' AND '$(TypeScriptVersionCheckResult)' == 'NoneSpecified') was evaluated as ('' == 'true' AND 'NoneSpecified' == 'NoneSpecified').
Task "Warning" skipped, due to false condition; ('$(TypeScriptShowVersionWarning)' == 'true' AND ('$(TypeScriptVersionCheckResult)' == 'Downgrade' OR '$(TypeScriptVersionCheckResult)' == 'Upgrade')) was evaluated as ('' == 'true' AND ('NoneSpecified' == 'Downgrade' OR 'NoneSpecified' == 'Upgrade')).
Task "Warning" skipped, due to false condition; ('$(TypeScriptBuildMode)' == 'true' AND ($(TypeScriptToolsVersion.StartsWith('2.')) OR $(TypeScriptToolsVersion.StartsWith('1.')))) was evaluated as ('' == 'true' AND (False OR False)).
Target Build:
Target CleanupEmptyRefsFolder:
Using "RemoveDir" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "RemoveDir"
Directory "C:\Projects\Dockertest\bin\Release\netcoreapp2.1\refs" doesn't exist. Skipping.
Done executing task "RemoveDir".
Target "ExecuteToolsTarget" skipped, due to false condition; ('@(ToolsTarget)' != '') was evaluated as ('' != '').
Target "_PackAsBuildAfterTarget" skipped, due to false condition; ('$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true') was evaluated as ('false' == 'true' AND '' != 'true').
Target "DotNetPublish" skipped, due to false condition; ( '$(DeployOnBuild)' == 'true' ) was evaluated as ( '' == 'true' ).
Done building project "Dockertest.csproj".
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:04:53.13
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
РЕДАКТИРОВАТЬ: Заметил, что VS "сидит" "слишком долго" в следующей задаче (до того, как этот шаг был быстрее):
docker build -f "C:\Projects\Dockertest\Dockerfile" -t dockertest --label "com.microsoft.created-by=visual-studio" "C:\Projects"