MojoPortal: Publishing with WebMatrix2
Written by Ian McIntosh Wednesday, 7 December 2011
Hello fellow hosters! This article builds on the previous article in the series.
I want to add in some Facebook support to my MojoPortal site. In order to do that, it is best to have a published site as some things only work on a published site. In this article, I am going to take the local MojoPortal website I have created in previous posts and useWebMatrix2 to publish it to the internet. I assume you already have your site open in WebMatrix2. I prefer to use WebDeploy as that makes publishing your database a piece of cake. You do need to make sure your remote site is setup for this, so that’s what I’ll do first.
Open the Arvixe Control Panel. You can do this by navigating to cp.yourdomainname.com.
1. Select Web | Web Sites…
Select your website from the list (if you haven’t already created it, you can use the Add Web Site button to create one)
3. On the Extensions tab, make sure that the ASP.NET option is set to 4.0 integrated.
4. Now make sure you press the Update button. If you don’t do this the changes from this page will be lost and you’re likely to end up causing a 500 – Internal Server error on all your websites!
5. Then go to the publishing tab. By default Web Deploy is turned off. Note the user name and type in a password (you will need this info later) then press enable. This may take a minute or two.
If you haven’t created a database on your remote server yet you will need to do this now.
There is a new option within control panel that allows you to automatically (with a bit of user interaction) build a publish settings file that you will be able to import into WebMatrix2.
To use this, navigate back into the properties dialog for your Website (Web | Web Sites | select your site) and to the publishing page.
6. Click on the link ‘Rebuild publishing profile for this website’ and it will prompt you to choose some options: select the database and database user from the picklist, FTP account is not needed.
7. Click the ‘download publishing profile for this web site’ link to start a file download and save the file for later use.
Note: I found when I tried this some of the data in the publish settings file was wrong. Hopefully this is just a teething problem and will be sorted soon, but these were the things I changed:
publish URL is the important one. This should be your Arvixe server. The other two are only used by links in WebMatrix for ‘get help’ and ‘hosting control panel’ so its not a big problem if those are not correct. Here’s my corrections:
Now switch back to WebMatrix2.
8. Select the tab ‘Remote’ and select ‘Settings’
9. If you created a publish settings file, Click on the ‘Import Publish Settings’ link and browse to your publish settings file:
Alternatively you can enter the information manually:
Server name is your Arvixe server. User name & password are those from the step above (ie, the web deploy user name and password). Site name and destination url are the url of your site (I am using a sub site). To set the database connection string, click in the edit box and WebMatrix will put up seperate boxes for the parts of the connection boxes as shown below.
10. Enter the relevant details in the boxes and WebMatrix turns them into a connection string. Click on validate and it will test it out for you.
It may take a couple of minutes, but it should come back with the green tick and ‘Connected Successfully’. Now you can press save.
Now I can use the WebMatrix2 publish button. First time round it will perform a couple of tests to make sure everything’s setup correctly. Then it creates a list of the files it will upload.
The first publish of a site can take a very long time (maybe a couple of hours) because there are a lot of files to send. Subsequent publishes don’t take so long as they only send files that have changed. On the first publish it will tick the box to publish the database by default. In subsequent publishes it won’t. You can still choose to tick the box and re-publish the database, but beware that this will completely overwrite your remote database (best to take a backup first). For this reason you generally should not republish the database after your site goes live.