dotnet-architecture / eShopModernizing

Modernizing existing .NET Framework, hypothetically legacy backoffice eShop web apps (traditional ASP.NET WebForms and MVC) with Windows Containers and Azure Cloud
MIT License
913 stars 552 forks source link

02. How to containerize the .NET Framework web apps with Windows Containers and Docker - errors #68

Open LucaOtto opened 2 years ago

LucaOtto commented 2 years ago

There are inconsistencies between the walkthrough and the actual experience locally on my environment.

Add - Docker Support generates only these two files in Solution Explorer ( VS 2022 Preview), no .yml are present as per screenshot of this walkthrough ( see section: Using Visual Studio to add Docker Support to the application.

image

Eventually two images are downloaded and extracted in Docker.

image

When build starts errors appears as below.

Lastly, website starts but it's broken:

image

Build started... 1>------ Build started: Project: eShopLegacyMVC, Configuration: Debug Any CPU ------ NU1608: Detected package version outside of dependency constraint: Autofac.Mvc5 4.0.2 requires Autofac (>= 4.0.1 && < 5.0.0) but version Autofac 6.1.0 was resolved. NU1605: Detected package downgrade: System.Diagnostics.DiagnosticSource from 4.7.1 to 4.5.1. Reference the package directly from the project to select a different version. eShopLegacyMVC -> Autofac 6.1.0 -> System.Diagnostics.DiagnosticSource (>= 4.7.1) eShopLegacyMVC -> System.Diagnostics.DiagnosticSource (>= 4.5.1) NU1605: Detected package downgrade: System.Threading.Tasks.Extensions from 4.5.2 to 4.5.1. Reference the package directly from the project to select a different version. eShopLegacyMVC -> Autofac 6.1.0 -> Microsoft.Bcl.AsyncInterfaces 1.1.0 -> System.Threading.Tasks.Extensions (>= 4.5.2) eShopLegacyMVC -> System.Threading.Tasks.Extensions (>= 4.5.1) 1> Consider app.config remapping of assembly "System.Net.Http.Formatting, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.2.7.0" [C:\Users\oluca.nuget\packages\microsoft.aspnet.webapi.client\5.2.7\lib\net45\System.Net.Http.Formatting.dll] to solve conflict and get rid of warning. 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): warning MSB3026: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): error MSB3027: Could not copy "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". Exceeded retry count of 10. Failed. The file is locked by: "vmwp.exe (23816), vmmem (2992)" 1>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4631,5): error MSB3021: Unable to copy file "obj\Debug\eShopLegacyMVC.dll" to "bin\eShopLegacyMVC.dll". The process cannot access the file 'bin\eShopLegacyMVC.dll' because it is being used by another process. ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

erjain commented 2 years ago

Hi @LucaOtto, Thanks for reporting the issue. Can you check once again after removing the container if any, removing the images and volume( if any)? The build error is showing that there is already another running process. The actual error may be different. Thanks

LucaOtto commented 2 years ago

Hi @erjain . Your ask is not clear. These Docker images were generated by the above command as per walkthrough. Without them there is no website to show. I see the error you mention, but I have no other images running other than the ones pulled when I add Docker Support to the project. I followed the steps again, same error as above. Thanks

erjain commented 2 years ago

Hi @LucaOtto, Sorry for the confusion. Please try resetting your docker desktop as shown below: Docker Reset.

And then, try adding docker files using the option of Container Orchestration support as below, build should be successful: Add Container Orchestration Support

LucaOtto commented 2 years ago

Hi @erjain I just added the Container Orchestration support and VS started pulling down the Docker image. Just a FYI: the walkthrough doesn't specify this step here ( https://github.com/dotnet-architecture/eShopModernizing/wiki/02.-How-to-containerize-the-.NET-Framework-web-apps-with-Windows-Containers-and-Docker#using-visual-studio-to-add-docker-support-to-the-application ) the first screenshot is not complete and the second one shows the files created after adding Container Orchestration. I'll confirm that it works once the container is live in Docker. Thanks.

LucaOtto commented 2 years ago

Hi @erjain I'm still seeing the same error when opening the website. I've attached VS output.

Docker Desktop shows these images and containers running, from which I start the website.

Thanks

image

image

VS output.txt