It’s great to use one-click Web Deploy function to deploy (publish) your website so as to make it available to other users over the Internet. By definition, Web Deploy is a useful client-server tool that is used to sync configurations and content to IIS (Internet Information Services). Note that, it acts as an extensible function of Visual Studio tapped by Microsoft to develop serial computer programs.
The use of Web Deploy enables you to deploy any web project to a hosting provider, a file on the network or a server within your internal network. Assuming you are using Visual Studio 2013, we’re going to explain how to publish your website on the target server by using the inbuilt Web Deploy publishing feature. Now, let’s dive deeper and know more details.
Step 1 – Initialize Web Deploy via WebSitePanel
To start with, you should enable “Web Deploy Publishing” function by logging into your control panel. Taking the mostly-used WebSitePanel control panel as an example here, you can simply log onto your hosting account with unique username and password. Upon entering, there will be a list of configuration options within the “Hosting Spaces” section, including “Domains”, “FTP Accounts”, “File Manager”, etc.
At this place, just go to “Web” > “Web Sites” and you will be able to create a new website or edit the existing one. Just click the link next to the website that you want to publish, and you will be turned to a new page where you can check “Web Site Properties.” As you can see, there are many editing tabs, among which “Web Publishing” option is where to enable publishing function.
Under this “Web Publishing” tab, you will be required to fill in username and password to proceed with this process. For security purpose, you’d better make the password as strong as possible. If done correctly, a success message will appear on this screen to prompt you to download publish profile as follows. Note that, this kind of publish profile is designed to specify the server and credentials you may use later on.
Step 2 – Open Your Visual Studio
The next step is to login to your Visual Studio application so as to open and edit your publishing project. If you are satisfied with all those customizations, you can right-click this project within the left-side “Solution Explorer” menu. As is displayed, there is a “Publish” option in this drop-down list, and you should make a hit on this option. By the way, it is possible to re-configure your website files from here, including “Content”, “Results”, “Scripts”, etc.
Step 3 – Import Your Publish Profile
Once clicked, there will a pop-up “Publish Web” window where you will be showeded with multiple options that include “Profile”, “Connection”, “Settings” and “Preview.” Inside the “Profile” tab, you can import your publish profile by clicking the “Import” option. Also, it is possible to use “Custom” settings. If you have the need to import your downloaded publish profile, you will have to click this “Browse” button to select it from the local computer.
Step 4 – Personalize the Connection Tab
After that, this “Publish Web” pop-up will advance to the next “Connection” tab automatically. From this new tab, you are allowed to make your connection settings by specifying “Published Method” and filling in publishing information. Note that, there are a total of four different methods for you to choose from, including:
- FTP – that allows you to deploy to a hosting provider that excludes the Web Deploy option. Note that, this method requires you to fill in a “Target Location” field with your own FTP and FTPS URL.
- File System – that allows you to publish your web application to a specified folder with your own FTP programs. It also needs you to validate the “Destination URL” text box that is used to automate opening a new browser for the successful deployment.
- Web Deploy – that allows you to automate the whole deployment tasks and publish content to IIS in a local computer for development purpose in the administrator mode. It is the most recommendable publish method, and you should make sure the hosting provider or server you’re deploying to also supports this function before starting out.
- Web Deploy Package – that allows you to create and publish a deployment package by filling out respective “Package Location” and “Site/Application” sections. Pay attention that, an IIS web project shouldn’t be specified with the same name as your application and web site.
Back to the ground, you need to choose the “Web Deploy” method here. Given that you’ve imported a publish profile in the last step, the rest of the setting fields will be filled in automatically as below. If not, you would have to input the following details:
- Server URL– is where to deploy your application to a hosting provider, the IIS on a local computer or internal server.
- Site Name – is where to fill in the name of your IIS web site and application, such as cosmos.com and cosmos.com/MyApplication.
- User Name & Password – is where to enter your credentials for an account so as to grant authority to perform certain deployment tasks.
Once done all those settings, simply click this “Validate Connection” button to get connected to a server. If there is a “Certificate Error” pop-up, you will need to check whether or not the publishing URL is correct. If it doesn’t work, then you can ask the ASP.NET hosting provider for help or consult the person who is maintaining the destination server. Finally, do not forget to press the bottom “Publish” option to go on.
Step 5 – Configure Data Settings Tab
In the next “Settings” tab, you should choose the “Release” publish method in the drop-down “Configuration” list. Beware that, the “Debug” method can be chosen only if you want to deploy to a test environment. Besides that, you also need to define the “File Publish” Options. Each option is quite self-explanatory, and you can check the correspondent box as you like.
Below that, there is “ApplicationDbContext” (DefaultConnection) box where you can select the remote connection string. If you don’t wish the connection string to be used at run time, you can uncheck this box next to the “Use This Connection String at Runtime” option. Pay attention that, this “Database” section is not meant for the File System, FPSE and FTP publish methods.
Given that you’ve clicked the checkbox next to the above-mentioned “Remote connection string” option, you will be displayed with a dialog window like the following one. Note that this combo box is included with strings from your publish profile or the databases you’ve connected to in “Server Explorer.” For now, you would specify the “Data Source” by clicking on the ellipsis button. After the completion of all customizations, you should hit the “OK” button to save changes.
Step 6 – Preview All Changes & Publish Your Project
Having finished configuring the database settings, you’d better take a preview of all files that will be deleted and copied to the hosting provider within this “Preview” tab. Just make a hit on “Start Preview” button and you will be presented with a full list of files as follows. Note that, all files on your application will be deployed to the hosting provider unless you make publish updates again.
It takes a while to accomplish the whole publishing process, and you can check whether deployment is successful in the “Output” window of Visual Studio. Alternatively, you can choose to go back to the WebSitePanel and navigate to “File Manager” > “YourSiteURL.” Within this wwwroot folder, there are a pile of uploaded files as below.