Wednesday, 16 January 2008

While we could do the same thing in IIS6, IIS7 introduced a much more convenient way to create self-signed SSL certificates for your web sites, as described by ScottGu on his blog. However, there is one problem with the way IIS7 does this: No matter what you do (as far as I know), the certificate will be created with the local computer network name as the CN, Common Name (the site name) in the certificate. The Common Name should match the web site's DNS address to be valid, and often the DNS name is different from the computer name. This site's DNS name is for instance hansolav.net, while the name of the server hosting the site is LABBETUSS2008.

If your certificate CN does not match the web site address, most browsers will tell the users that you have a foobar SSL setup (even more foobar than not having a certificate from a trusted authority), and some (the newest version of FireFox, among others, I think) will completely refuse to open your site.

The good thing is that there's a way to fix it, and that is reverting to the way we had to do this in IIS6; using SelfSSL.exe from the IIS6 Resource Kit Tools. Below are the steps to to this:

  1. Download and install the IIS6 Resource Kit Tools from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en
    Note: I don't know if the Resource Kit will install on Vista or Windows Server 2008, I had the Resource Kit installed on a Windows 2003 box and just copied SelfSSL.exe.
  2. Look up the site ID of the web site you want to enable for SSL by selecting the "Sites" node in the tree in IIS7 Manager.
  3. Run SelfSSL /N:CN=<your web site address (no http://)> /V:<how many days the certificate should be valid> /S:<site ID from above> [/P:<port, if not 443>]
  4. Test your site.

Note2: It is possible that you will need to install the IIS6 compatibilty components for IIS7 in order for this to work - I don't know. You install them from the Add/Remove Windows Components dialog, or the Web Server Role configuation in Windows Server 2008.

Does anyone else know of an easier way to do this? I searched a bit without finding anything. What about adding an option to choose the CN in the "Create Certificate wizard", IIS7 team?

posted on Wednesday, 16 January 2008 23:14:01 (W. Europe Standard Time, UTC+01:00)  #    Comments [4]
 Tuesday, 08 January 2008

When living on the edge (read: running the latest betas of everything) as I do, you get trouble from time to time. This time it was Visual Studio 2008 "Data Dude" combined with SQL Server 2008. For those of you not familiar with it, "Data Dude" is an extension to Visual Studio for working with databases; unit testing of your database, automatic data generation etc.

My problem was that I kept getting a message saying "Object reference not set to an instance of an object." all the time when I tried to create a new database project. I suspected that SQL 2008 was the cause, and I was right. It turns out that "Data Dude" creates a temporary database when you're opening or creating a project. In my case this happened in the default SQL Server instance on the machine, which is SQL Server 2008 CTP5 Dev Edition. "Data Dude" didn't like that very much.

The solution (at least in my case) was to configure it to use the installed SQL Server 2005 Express Edition instead. You do that by going to Tools -> Options -> Database Tools -> "Data Connections" and
"Design-time Validation Database". Fill in the instance name of a SQL 2005 instance in the text boxes. So now you know!

posted on Tuesday, 08 January 2008 01:23:28 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
 Tuesday, 11 December 2007

I've been working a little with SQL Server Compact Edition (which is a *very* cool product, by the way) lately. For those of you that haven't heard about SQL Compact: It's a small version of SQL Server that you host in-process in your .NET applications (it's just a couple of MBs) with full support for tables, indexes, transactions and so on (but no views, stored procedures or triggers). Much like SQLLite and Apache Derby, just better integrated with .NET.

So far I've been using Visual Studio to create and manage databases. This works great, but I didn't like to start up VS and everything just to peek into a database, and I've always felt more at home in SQL Server Management Studio (SSMS) when working with databases. Well, it turns out that SSMS can be used to manage SQL Compact databases as well! Cool, I didn't know that.

This is basically what you do:

Robert has some more on this on his blog.

posted on Tuesday, 11 December 2007 12:38:13 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
 Friday, 07 December 2007

Vista SP1 RC and Windows Server 2008 RC1 is now available to MSDN subscribers! Vista SP1 will also be available as a public download from Microsoft sometime next week.

I downloaded and installed Vista SP1 yesterday, and everything went smooth. I haven't noticed much difference yet, but I haven't looked much either.

I also downloaded Windows Server 2008 RC1 and upgraded the server hosting this site (from RC0). I had some trouble initially, because the RC1 upgrade is blocked if you have SharePoint installed (probably due to the fact that they have removed the SP role from Windows and are providing it as a separate download). I had SharePoint installed, but the server Role had disappeared, so I couldn't uninstall it! After some thinking I solved it by getting the separate SharePoint download, which offered me an uninstall option when I ran it.

Below is a screenshot of my potentially risky remote upgrade of the server hosting this site. It's the second time I've upgraded it successfully over Remote Desktop, so it seems to work :-)

posted on Friday, 07 December 2007 17:37:51 (W. Europe Standard Time, UTC+01:00)  #    Comments [1]
 Monday, 19 November 2007

Yep, the November CTP was released just hours, maybe minutes ago! As of now, they still haven't posted the link on the SQL Server home page. The downloads have been posted on the Microsoft Download Center for easier availability, follow this direct link to get to the bits:
http://www.microsoft.com/downloads/details.aspx?FamilyId=3BF4C5CA-B905-4EBC-8901-1D4C1D1DA884&displaylang=en

There you can find DVD images and self extracting executables for x86, x64 and IA64. This CTP includes SQL Server Express Edition as well.

Happy downloading!

posted on Monday, 19 November 2007 20:21:55 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
 Sunday, 18 November 2007

I month ago my team (Åsmund Eldhuset, Frank Robert Kvam and me) came second in the Nordic Collegiate Programming Contest at NTNU (13th in total) and thereby qualified us for the Northwestern European Programming Contest (NWERC) in Utrecht, The Netherlands.

NWERC is happening this weekend, and the contest itself is today. You should be able to follow the standings live at http://2007.nwerc.eu/live/scoreboard, and if the web cam works (it doesn't right now, it looks like), you should be able to see us as well here: http://2007.nwerc.eu/live/cam3.

 

posted on Sunday, 18 November 2007 08:57:22 (W. Europe Standard Time, UTC+01:00)  #    Comments [2]
 Wednesday, 14 November 2007

While we're waiting for the next SQL Server CTP, it thought I could mention a couple of small things already in the current CTP: Multiple row Insert and Declare-Set combined.

To insert multiple rows  in SQL Server 2005 and before, you had to execute multiple INSERT statements, or use UNION. The first would look like this:

INSERT INTO MyTable (Col1, Col2)
VALUES (1, 'One') INSERT INTO MyTable (Col1, Col2)
VALUES (2, 'Two') INSERT INTO MyTable (Col1, Col2)
VALUES (3, 'Three')

And using UNION it would be

INSERT INTO MyTable (Col1, Col2)
          SELECT 1, 'One'
UNION ALL SELECT 2, 'Two'
UNION ALL SELECT 3, 'Three'

In SQL Server 2008, this can be done like this:

INSERT INTO MyTable (Col1, Col2)
VALUES (1, 'One'), (2, 'Two'), (3, 'Three')

I did some quick performance testing and found that UNION and multiple inserts runs on about the same time, while the single inserts are slower. But this is only true as long as the numbers of rows being inserted isn't to high. If inserting 10 000 rows in one go, for instance, the individual inserts are actually faster, probably because of the amount of in-memory data the unions and the multiple row inserts produce, as well as that the last two commands run the whole batch within on large transaction.

Then, Declare-Set combined: It has long irritated me that I had to use two lines to declare a variable and assign a value to it. This is what it looks like i SQL Server 2005 and earlier:

DECLARE @var int
SET @var = 50

Now, in SQL 2008, we can do this:

DECLARE @var int = 50

We can also declare and assign to multiple variables in one go:

DECLARE @var1 int         = 50,
        @var2 varchar(10) = 'Hello!'

Pretty basic, and it's probably long overdue, but it's neat and it's finally here :-)

posted on Wednesday, 14 November 2007 05:06:28 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]
 Tuesday, 13 November 2007

Microsoft Norway is running a gadget competition at http://www.gadgetcompetition.no/ these days where users can submit Vista Sidebar Gadgets and Windows Live Gadgets.

My contribution is a Vista Sidebar gadget where you can track packages and letters sent via the Norwegian Postal service, Posten. By entering you package tracking number, the gadget will get the latest updates for you package every 30 minutes and display its status in the sidebar. You can also click the envelope to open up the full package history in a fly out window.

So, if you like the idea, go to the competition site, and download my gadget from the "Gadget Gallery", or use this direct link to live.com. If you like it, please log in with your Windows Live account on www.gadgetcompetition.no and vote for me :-) You can win Vista Ultimate, a mouse or Expression Web just by voting :-)

posted on Tuesday, 13 November 2007 02:10:00 (W. Europe Standard Time, UTC+01:00)  #    Comments [3]