|
| 1 | +--- |
| 2 | +meta: |
| 3 | + title: Publishing a website to a Windows Instance using Web Deploy |
| 4 | + description: Learn how to configure a Scaleway Instance with Windows Server to remotely publish web applications using Web Deploy. |
| 5 | +content: |
| 6 | + h1: Publishing a website to a Windows instance using Web Deploy |
| 7 | + paragraph: Learn how to configure a Scaleway Instance with Windows Server to remotely publish web applications using Web Deploy. |
| 8 | +tags: instances windows-server iis web-deploy |
| 9 | +categories: |
| 10 | + - instances |
| 11 | + - elastic-metal |
| 12 | +dates: |
| 13 | + validation: 2025-01-20 |
| 14 | + posted: 2025-01-20 |
| 15 | +--- |
| 16 | + |
| 17 | +## How to use Web Deploy to publish a website to Scaleway's Windows Server VMs |
| 18 | + |
| 19 | +This guide explains how to publish a web application to a Scaleway Instance with Windows Server using the following tools: |
| 20 | +- [IIS](https://iis.net/), which is the default web server developed by Microsoft for hosting web applications on Windows. |
| 21 | +- [Web Deploy](https://www.iis.net/downloads/microsoft/web-deploy), a single-click remote deployment technology for IIS. |
| 22 | + |
| 23 | +Throughout this guide, you will learn how to: |
| 24 | +- Configure the Windows Server Instance with Web Deploy; |
| 25 | +- Set up a website in IIS; |
| 26 | +- Publish an application directly from Visual Studio. |
| 27 | + |
| 28 | +<Macro id="requirements" /> |
| 29 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 30 | +- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 31 | +- An [Instance](/compute/instances/how-to/create-an-instance/) running Windows Server or Windows Server Core |
| 32 | + |
| 33 | +<Message type ="note"> |
| 34 | + The Windows Server Instance must have an [IPV4 address attached](/compute/instances/concepts/#dynamic-ip). |
| 35 | +</Message> |
| 36 | + |
| 37 | +## Configuring Windows Server to accept Web Deploy |
| 38 | + |
| 39 | +In Windows Server, IIS and its remote management components are not installed by default and need to be added as features. Web Deploy, a tool for deploying web applications, is distributed separately by Microsoft. Here is how to set up your Windows Server to accept Web Deploy: |
| 40 | + |
| 41 | +1. [Connect](/compute/instances/how-to/connect-to-instance/) to your Windows Server Instance and open a PowerShell prompt. |
| 42 | + |
| 43 | +2. Install the necessary IIS features and management tools: |
| 44 | + ```powershell |
| 45 | + Install-WindowsFeature Web-Server, Web-WebServer, Web-Mgmt-Tools, Web-Mgmt-Service |
| 46 | + ``` |
| 47 | + |
| 48 | +3. Download and run the Web Deploy installer. An up-to-date, direct download link can be found at https://aka.ms/webdeploydownload: |
| 49 | + ```powershell |
| 50 | + Invoke-WebRequest -Uri "https://download.microsoft.com/download/b/d/8/bd882ec4-12e0-481a-9b32-0fae8e3c0b78/webdeploy_amd64_en-US.msi" -OutFile webdeploy.msi |
| 51 | + Start-Process msiexec.exe -ArgumentList '/i webdeploy.msi' |
| 52 | + ``` |
| 53 | + |
| 54 | +4. Follow the installation wizard launched by the previous command. When prompted, select the *Complete* installation. |
| 55 | + |
| 56 | +5. Start the Web Management Service for IIS: |
| 57 | + ```powershell |
| 58 | + Start-Service WMSVC |
| 59 | + ``` |
| 60 | + |
| 61 | +## Creating the website configuration in IIS |
| 62 | + |
| 63 | +The Instance is now ready to accept Web Deploy connections. You will create a configuration for a new website in IIS to use as a Web Deploy target. In this guide, the website is named *MyApplication*. |
| 64 | + |
| 65 | +1. Create a directory for the website: |
| 66 | +```powershell |
| 67 | +mkdir "C:\inetpub\wwwroot\MyApplication" |
| 68 | +``` |
| 69 | + |
| 70 | +2. Create a new website in IIS with the specified name and path: |
| 71 | +```powershell |
| 72 | +New-Website -Name "MyApplication" -PhysicalPath "C:\inetpub\wwwroot\MyApplication" |
| 73 | +``` |
| 74 | + |
| 75 | +3. Remove port bindings of the default website and create a new binding for the MyApplication website on port 80: |
| 76 | +```powershell |
| 77 | +Remove-WebBinding "Default Web Site" |
| 78 | +New-WebBinding -Name "MyApplication" -IPAddress "*" -Port 80 -HostHeader "" |
| 79 | +``` |
| 80 | + |
| 81 | +4. Start the newly created website: |
| 82 | +```powershell |
| 83 | +Start-Website -Name "MyApplication" |
| 84 | +``` |
| 85 | + |
| 86 | +## Publishing from Visual Studio |
| 87 | + |
| 88 | +1. Open or create a web project in Visual Studio. |
| 89 | +2. Right-click the solution and select **Publish**. |
| 90 | +3. Choose **Web Server (IIS)** and click **Next**. |
| 91 | +4. Select **Web Deploy** and click **Next**. |
| 92 | +5. Set up the publish profile: |
| 93 | + - Server: `<Your_Instance_IP>:8172` |
| 94 | + - Site name: MyApplication |
| 95 | + - Destination URL: `<Your_Instance_IP>` |
| 96 | + - User name: Administrator |
| 97 | + - Password: (Use the password retrieved earlier) |
| 98 | + <Lightbox src="scaleway-webdeploy_profile.webp" alt="A screenshot of the Web Deploy profile configuration in Visual Studio" size="medium" /> |
| 99 | +6. Click **Finish** to create the profile. |
| 100 | +7. Click **Publish** to deploy your website. |
| 101 | + |
| 102 | +## Accessing your website |
| 103 | + |
| 104 | +Open a web browser and navigate to your server's IP address. Your website should now be live. |
| 105 | + |
| 106 | +<Message type="note"> |
| 107 | + Depending on your website technology, you may need to install additional runtime components on the Windows Server instance, such as the [.NET hosting bundle](https://dotnet.microsoft.com/en-us/download/dotnet). |
| 108 | +</Message> |
0 commit comments