WebsitePanel : How to get working on Windows 7
About a year ago the Hosting company I use announced it was moving from Plesk to DotNetPanel. As I didn’t like Plesk and a brief look at DNP showed it had Zip and UnZip options within the FileManager, I immediately ask to be converted. Since then I’ve continued to be pleased by this decision, but it was only recently that I discovered DNP has gone Open Source and become WebsitePanel.
Therefore, I couldn’t resist having a look at how it works and see whether I could install it on my laptop. What I wasn’t expecting was the Installer indicated Windows Server was required. I posted a question on the Forum and one reply said it did work on Windows 7 and the other suggested using the Windows Server 180 day trial.
Not knowing WebsitePanel installing on Windows Server was my only option. Using VirtualBox, I installed Windows Server 2008 R2 Standard. Installation was straightforward other than my first repowering of the  instance failed -that needed a reboot of the laptop itself to resolve. In my haste I couldn’t resolve the networking issue preventing me from accessing SQL Server Express on my laptop, so I installed another copy on the Server.  After disabling much of the restrictive security that was annoying me, I installed Websitepanel in standalone mode without any issues. The installer created three websites, the database WebsitePanel, three local user accounts and hosting space in C:\HostingSpaces. Browsing to the three sites in turn, Enterprise Server http://127.0.0.1:9002/ and  Server http://127.0.0.1:9003/  show status pages, and the Portal http://127.0.0.1:9001 shows a login prompt. The highest authority login is “serveradmin” and the password was set during the installation. And if you ever forget the “serveradmin” password it’s via the installer you can reset it. The installer also creates an “admin” account using the same password. I then spent some time using the “serveradmin” account, creating customers and hosting spaces – all seemed to be working fine.
Since the three websites seemed very straightforward and all files seemed to have the same date except  each site’s web.config, I concluded it was just these three files that were modified during the installation. The next task was to see if these websites would work in my Windows 7 laptop. So I zipped them up, transferred them to my laptop and created websites using IIS Manager in the normal way. During my review of the website files I found the database install sql in the Setup directory of the Enterprise Server. On closer inspection the very first line of the sql file was parameterised – USE [${install.database}], I edited it to USE [WebsitePanel], created the database with Management Studio and ran the sql without issue. I then ran up the three websites and held my breath as the sites appeared to take a long time to initialise – but they did. I now had WebsitePanel working but with an empty database. I could of course have migrated the database from the Windows Server install, but as I wanted to see whether I could install  on Windows 7 directly, I decided I would see how I could login when the database wasn’t created via the installer.
Looking at the dbo.Users table I could see just a single “serversadmin” account but with a blank password. I knew from my previous installation on Windows Server the password was created during the install and was encrypted, so what was I to do now. My first attempt was just to copy the password and this worked fine, but that wouldn’t help you as the idea is to avoid the Server installation step. I could publish a default password here in this blog, but that seemed to me to be irresponsible. Then I noticed “<add key="WebsitePanel.EncryptionEnabled" value="true" />” in the Enterprise Server’s web.config. Changing to false allowed me to enter a password of my choice into the password field of the serveradmin row in dbo.Users and successfully log in. WebsitePanel seems to me to be working fine, so I achieved my aim of having it work on Windows 7.
But what do you have to do if you wish to avoid the Server install step. Well, if you look at the downloadable files at http://sourceforge.net/projects/websitepanel/files/ you’ll see that the three server components are available for separate download. When you unpack them and look at the web.config files of the Enterprise and Server sites you’ll see they are parameterised, (a) connectionString="${installer.connectionstring}", (b) key="WebsitePanel.CryptoKey" value="${installer.cryptokey}", (c ) <password value="${installer.server.password}" />. Substituting actual strings specific to your installation avoids the need for the installer.
That gets you a local installation with an unencrypted password, which is fine for training purposes. I’m not suggesting this approach is desirable for production. But what would you do if you wanted encrypted passwords? Well, as this is now open source you can obtain the source code and look for a method called encrypt(). I found very easy to copy this method into a test harness and create an encrypted password that I could cut and paste into the database password field. Again it seems irresponsible to post the code here – but it’s easy. I must admit that I haven’t been able to compile the source code – there seems to be 3rd party libraries missing, so I’ll have to leave that to another post.