In all the previous chapters, we have done all the work on a local computer, including testing pages. To run our *.cshtml pages, we were using the IIS Express web server that's built into the WebMatrix. But these pages were only accessible on the local computer. To make the website visible to others, we will need to publish it on the Internet.
Publishing your website means that you will have an account with a hosting provider.
A hosting provider is a company that owns publicly accessible web servers and that will rent you space for the site.
Hosting plans run from a few dollars a month or even free for small sites to hundreds of dollars a month for high-volume commercial websites.
When you want to publish the website, the first thing you will need is to find a hosting provider. You can look for one by searching the web or also right from within the WebMatrix.
You can see the Publish button on the Home tab of the WebMatrix ribbon. Click on Publish and you will see the following dialog.
Click on the Find Windows web hosting and it will open a page on the Microsoft site that lists hosting providers that support ASP.NET as shown in the following screenshot.
Some sites offer a free trial period. A free trial is a good way to try publishing and hosting a website by using the WebMatrix. We will select Everleap, which has a 30-day free trial.
Click on the TRY IT FREE.
Create an account from any of the above shown site plans. Once the account is created, we will receive an email with all the necessary information. Then login to the Everleap website and go to the following page − https://cp.everleap.com/sites/manage.aspx
We will get to see all the necessary information with the help of which you can publish your website. Now let’s go to the WebMatrix and click on Enter Settings on Publish your Site dialog and you will see the Publish Settings dialog and enter the following information from the above page.
Click Validate Connection. If everything is ok, the dialog box reports Connected Successfully, which means it can communicate with the hosting provider's server as shown in the following screenshot.
Click Save to save your settings.
WebMatrix offers to perform a test to make sure that it can communicate correctly with the hosting site as shown in the following screenshot.
Click Continue to start the publish process.
As you can see the list of files to publish includes the web pages that are created. Click Continue.
WebMatrix copies your files to the hosting provider's server. When it's done, the results are reported in the status bar. Once the site is published successfully, click on the url mentioned in the status bar and you will see that the site is live now.