skip to Main Content

I’m trying to setup a Web Deploy publish method within Visual Studio for an ASP.NET Web Application [Web Forms project]. In all the learn.microsoft articles it recommends Web Platform Installer (WPI). However WPI has been sunset and it’s not supported/Running.

I’ve attempted to install the Web Deploy portion individually, however VS is unable to connect with: "Could not connect to the remote computer. On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service" is started."

The documentation specifically states that installing Web Deploy directly "will not configure Web Management Service"

That said, what’s the recommended way of configuring a Web Server (Windows Server 2022), to be the target of a Web Deploy Publish?

2

Answers


  1. Chosen as BEST ANSWER

    I was able to locate a method of installing "Web Management Service" through the Management Tools within Add Features, or by using PowerShell. I followed the article here: Install IIS Web Management Service for Remote IIS Administration and Management, which goes step by step to install, start, and configure the Firewall rules. I'll describe them here incase that link stops working in the future.

    1. Install Management Service: This can be done with PowerShell running as Admin:
      Install-WindowsFeature Web-Mgmt-Service Or by opening "Add Remote Features" wizard > Server Roles > Web Server (IIS) > Management Tools > And selecting "Management Service"
    2. Enable Remote Management: This can be done using PowerShell as well: Set-ItemProperty HKLM:SOFTWAREMicrosoftWebManagementServer -Name EnableRemoteManagement -Value 1 -PropertyType DWORD -Force & Set-ItemProperty HKLM:SOFTWAREMicrosoftWebManagementServer -Name RequiresWindowsCredentials -Value 1 -PropertyType DWORD -Force.. However this step did not work for me, and instead I used IIS > Select the Server Node from the Connection Tree view (left side) > Double Click "Management Services" > Check "Enable Remote Connections" and Selecting Apply and Start. Note If options are grayed out you only need to press stop from the action pane to stop the service
    3. Add IIS Remote Management Rule in Windows Firewall: PowerShell- By Service: netsh advfirewall firewall add rule name="IIS Remote Management" dir=in action=allow service=WMSVC or By Port: netsh advfirewall firewall add rule name="IIS Remote Management" dir=in action=allow protocol=TCP localport=8172 or by using the Windows Firewall GUI.

    There are also some additional resources I found while drafting this response here: Configuring remote Administration and feature delegation in IIS 7 which goes into more details upon configuring the Management Service and IIS after the fact to get it connect. I had several validation errors when initially setting up the Web Deploy package for my Visual Studio project, but I was able to troubleshoot those issues and get the publish to run successfully to the remote server.


  2. Well, for one, you don’t mention what kind of web site this is?

    Is it a asp.net web site?
    Or
    Is this a asp.net web site application?

    I often for example do a "local" publish. That results in a folder on my local computer that can be "transferred" to the server running IIS.

    So, in that case, I publish like this:

    enter image description here

    At that point, I have a folder called "Web".

    I then zip the file, and then can remote into the web server, and I copy this folder (I zip it, since copy of one file goes much faster). And the site is about 110 megs in size, but zipped, its about 46 megs.

    So, once I have the folder on the server, then I un-zip (to a folder called stage).

    I then stop IIS, copy the files to the site folder (C:inetpubwwwroot), and then start IIS.

    Now, I COULD publish as FTP, but I turned FTP off (for increased security).

    and while I do remote into the server (remote desktop), I can only do as such via a VPN, and the public facing port(s) don’t have nor allow RDP.

    I also when on site, or on the same network, I will publish directly to a shared folder on the network. (so, saves a bit of time, don’t have to publish local, then zip.

    So, I’m using vs2022, and the web site publish option works quite well, and gives the option to publish to a folder, publish via FTP, or of course that 3rd option of using web deploy options. However, I don’t like (nor use that option), again for reasons of increased security.

    And I could probably setup a batch file/script that somewhat help and automate this process a bit further, however I’m only updating the site say a few times a week, so it well under a 5 minute task time wise anyway.

    My web site is a asp.net website "application" (web forms, .net 4.8), using vs2022 for this.

    So, when I publish, then of course all source code is stripped out, project is compiled, and the resulting folder is a web server ready web site. At that point, all I have to do is copy (over write) the existing site, and I do stop IIS for this copy). Note that I thus use what is called "x-copy" updates. There are 1 or 2 folders on the side that I don’t have on my development computer, and that’s the folders for let’s encrypt and that enables the https security certificate part, of which I don’t use nor care during development.

    So, on my dev computer, I run the site/project as http, but in production, it of course runs as https.

    I also of course use the "web.config" transform that works during the publish process that updates the connection strings from my local computer (.SQLEXPRESS) to the actual server name + sql instance and passwords during the publish process).

    And while I as noted am using a asp.net web site "application" as opposed to a asp.net web site?

    A web site ALSO has the publishing wizard and option – and it works for web sites, and it works even in vs2022.

    So, you not noted if you have FTP ability, but that’s a possible. And as noted, publish to a folder, and then finding a means to copy that resulting folder to the server is really all you require here.

    Much of this "choice" and "road" will depend on what type of site you have, and do you have options like say remote desktop, or a VPN or FTP.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search