Switch Azure Development Storage to SQL Server Express – Step by Step

Article

While developing for Windows Azure, I recently got lots of StorageExceptions reading “(500) Internal Server Error.”.

After some googling I found an article that says I should switch to SQL Server Express. So far, so good. But how do I do this?

  1. Download SQL Server Express. (If you’re using Visual Studio, chances are that you’ve already installed SQL Server Express.) You may also want to down SQL Server Management Studio (same download link).
  2. Make sure SQL Server is running. Go to All Programs -> Microsoft SQL Server 2012 -> Configuration Tools -> SQL Server Configuration Manager. Under SQL Server Services make sure SQL Server (SQLEXPRESS) is running. (Otherwise start it by right-clicking on it and clicking on Start.)
  3. (Optional) Open SQL Server Management Studio.

    • In Connect to Server under Server Name click on the dropdown button and choose <Browse for more...>. You can then select your local SQL server instance. It should by named like COMPUTERNAME\SQLEXPRESS. (For Authentication keep Windows Authentication.)
    • Under Databases later something like DevelopmentStorageDb22 will appear, once we switched the development storage to SQL Sever.
  4. Open All Programs -> Windows Azure SDK, right-click on Windows Azure Storage command line and choose Run as administrator.

That’s it.

Update: The Azure Development Table Storage’s size seems to be limited to 4 GB (even though since SQL Server Express 2012 it should be 10 GB). You can see the size of your database (or of the PRIMARY file group, to be more precise) in the database properties in SQL Server Configuration Manager:

full-database.png

As you can see in the image, my database is already full. (Initially the size is about 3 MB.) Once you get there, you’ll see error messages like these in your Development Storage logs:

Could not allocate space for object ‘dbo.TableRow’.’PK_dbo.TableRow’ in database ‘DevelopmentStorageDb22′ because the ‘PRIMARY’ filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

To “fix” this problem, you can only delete the database or delete Table Storage tables to decrease the database’s size.

Switching OpenID providers through delegation

Article

Back in the days, when I decided to join StackOverflow, I was forced to create an OpenID – because this is the way to login on StackOverflow.

I decided to use an independent OpenID provider, called myOpenID. I also set up OpenID delegation. This way I could use my own domain name as my OpenID. (OpenID uses URLs as user names, like http://manski.net.)

Now, myOpenID is shutting down on Feburary 1, 2014. Thus, I had to switch my OpenID provider.

Fortunately, OpenID delegation makes this easy – you just replace the two delegation <link> tags and you’re done.

Unfortunately, not all OpenID providers seem to support this. I tried Google (which should work according to this), but StackOverflow always wanted to create a new account for me. (May also be StackOverflow’s fault, I don’t know.)

Fortunately, StackOverflow provides its own OpenID service:

https://openid.stackexchange.com/

So I created a new OpenID there, replaced the <link> tags (details), done. Works like a charm.

Windows Performance Counter Types

Article

There are several types of performance counters in Windows. However, I had a hard time of understanding all these types just from their documentation. So I decided to compile some examples for each counter type.

I also wrote some C# code to demonstrate how to use performance counters. You’ll find it at the end of this article.

Read more →

Disable UAC in Windows 8

Article

In Windows 8, Microsoft changed the UAC slider’s lowest setting from “Disable UAC” to “Hide UAC”.

So, even with the lowest setting programs will still not run with Administrator privileges (like in Windows 7).

Windows' "Run" dialog with UAC still active.
Windows’ "Run" dialog with UAC still active.

To disable UAC, execute this PowerShell script as Administrator (e.g. via powershell from an Admin Command Prompt):

Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "0"

After that restart and UAC is disabled.

Windows' "Run" dialog with UAC disabled.
Windows’ "Run" dialog with UAC disabled.

Notes:

  • Only do this, if you’re aware of the consequences. Disabling UAC may make the system less secure.
  • The Windows 8 Store can’t be used anymore if UAC is disabled. (You can, especially, no longer installed Windows 8.1.)
  • To reenable UAC, use -Value "1" in the command above.

LINQ to SQL – bits and pieces

Article

In a project I’m currently working on we’re using LINQ to SQL. While most of it is straight forward, there are some quirks that are not that obvious (at least to me).

This article is mostly a FAQ but I will explain some of the not-so-obvious features in more detail.

Note: I’m not going to explain how to setup the connection to the database in this article. I’m assuming that this already works.

Read more →