Friday, March 9, 2007

Personal Web Site Starter Kit fully functional now

Recently I blogged about the Personal Web Site starter kit (here and an update here) and mentioned that it was not fully functional due to problems with our implementation of the SqlClient (and, as it turned out, missing features in our Tds code). Since today this is no longer true - thanks to Andreia and Nagappan PWS is fully functional when running under  Mono now! Below are instructions on how to run the starter kit yourself.
  1. Download the kit
  2. Check out the InstallVST utility from Mono SVN (it's in mcs/tools/installvst) and compile it:
    gmcs installvst.cs
  3. Unpack the PWS zip file to some directory
  4. Run the following command:
    mono PATH_TO/installvst.exe PATH_TO_PWS_DIRECTORY/ PersonalWebSite.vstemplate PATH_TO_TARGET_DIRECTORY
  5. Go to the PATH_TO_TARGET_DIRECTORY/PersonalWebSite/ directory, edit the web.config file you find there find the Personal and LocalSqlServer connection strings and replace their connectionString attributes with, respectively, the following values:
    Data Source=XXX.YYY.VVV.ZZZ;Integrated Security=False;Database=startkit_personal;User ID=sktest;Password=sktest
    Data Source=XXX.YYY.VVV.ZZZ;Integrated Security=False;Database=aspnetdb;User ID=sktest;Password=sktest
    Substitute the XXX.YYY.VVV.ZZZ strings with the IP number of your SQL server
 
Having completed the above steps, you need to prepare your Microsoft SQL server (either the full version or SQLExpress) for use with the starter kit. Follow the instructions below:
  1. Make sure your SQL server uses mixed SQL + Windows authentication, allow connections over TCP/IP (server port 1433)
  2. Create an SQL user named 'sktest' with the password 'sktest'
  3. Create an empty database named aspnetdb, then fill it with required schema using the aspnet_regsql utility that comes with Microsoft .Net 2.0 SDK. This database can be shared among all the starter kits ported to Mono. Add the 'sktest' user to this database users and make it the database owner.
  4. Create an empty database named startkit_personal, then use personal-add.sql script found in the PWS zip archive to populate it with the necessary schema and data. Add the 'sktest' user to this database users and make it the database owner.
At this point you are ready to run the application. To do so, issue the following command on your mono machine:
MONO_IOMAP=all xsp2 --root PATH_TO_TARGET_DIRECTORY/PersonalWebSite/
and then point your browser to http://localhost:8080/ (replace 8080 with the port number your xsp is configured for).
If everything went well, here's what you should see in your browser:

The welcome screen



The welcome screen after logging in



One thing should be noted about the user registration with this starter kit. The application is configured so that every new user is created in the disabled state - that is, you will not be able to log in even though the user has been created successfully. To remedy that, you have two options:
  1. Edit the Register.aspx file and remove (or set to false) the DisableCreatedUser attribute to the <asp:CreateUserWizard> tag in that file
  2. On your Windows machine launch the SQL Server Management application, connect to the aspnetdb database and issue the following query:
    UPDATE dbo.aspnet_Membership SET IsApproved=1
    This query will approve all the users you have registered (if you want to do it for individual users, you need to consult the dbo.aspnet_Users table, look up your user, note its ID and append WHERE UserId=YOUR_USER_ID clause to the above query)

No comments: