Problem with WebDeploy and Windows Server 2019

When you want to use WebDeploy on a Windows Server 2019 and you have also Visual Studio 2022 installed on that server, then you find WebDeploy 4.0 also installed. This was part of Visual Studio installation. This constellation might be the reason why web deployment does not work because you receive a 404 error from the client, from which you want to install your IIS application. This is because there is a problem with the installation of all necessary server components by Visual Studio on that server. You can also find this explained here: https://stackoverflow.com/questions/74411121/web-deploy-4-gives-404-web-deploy-3-6-works-while-not-changing-anything-else

The easiest way to fix this is to deinstall web deploy 4 and then to install web deploy 3.6.