[英]Changing Asp.net core Docker target from Windows to Linux
I have created a new ASP.net application by Visual Studio 2019. When I was creating the project, I ticked the Docker Support checkbox and selected Windows for my docker.我通过 Visual Studio 2019 创建了一个新的 ASP.net 应用程序。在创建项目时,我勾选了 Docker Support 复选框并为我的 docker 选择了 Windows。 After a while, I decided to change my docker from Windows to Linux as I have some other software on Linux container and every time I need to switch.
一段时间后,我决定将我的 docker 从 Windows 更改为 Linux,因为我在 Linux 容器上有一些其他软件,并且每次需要切换时。 I did some research and I found out if I change the server URL inside the DockerFile, I can change it to Linux.
我做了一些研究,发现如果我更改 DockerFile 中的服务器 URL,我可以将其更改为 Linux。 By doing it I encounter this error: Your Docker server host is configured for 'Linux', however the project targets 'Windows'
通过这样做,我遇到了这个错误:您的 Docker 服务器主机配置为“Linux”,但是该项目的目标是“Windows”
Then I opened the Cs proj file and change the windows to Linux and now I see: Unable to copy file obj\\debug\\netcoreapp2.1\\xxxx.dll to bin\\debug\\netcoreapp2.1\\xxxx.dll.然后我打开 Cs proj 文件并将 Windows 更改为 Linux,现在我看到:无法将文件 obj\\debug\\netcoreapp2.1\\xxxx.dll 复制到 bin\\debug\\netcoreapp2.1\\xxxx.dll。 Access to the path bin\\debug\\netcoreapp2.1\\xxxx.dll is denied.
对路径 bin\\debug\\netcoreapp2.1\\xxxx.dll 的访问被拒绝。
I reverted the change but I still see the same error.我恢复了更改,但仍然看到相同的错误。
在记事本++之类的文本编辑器中编辑您的 .csproj 文件,您应该会看到 DockerDefaultTargetOS 标记,它应该会读取 Windows 将其更改为 Linux
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.