Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

Writing batches to Azure Table Storage

Writing records to Azure Table Storage in batches is handy when you are writing a lot of records because it reduces the transaction cost. There are restrictions however. The batch must:

  • Be no more than 100 records
  • Have the same partition key
  • Have unique row keys

Writing batches is easy, even adhering to the above rules. The problem however is that it can start to result in a lot of boilerplate style code. I created a batch writer class to abstract this logic away.

Read More

VS2013 project templates fails to build on TF Service

My upgrade pain with VS2013 and the Azure SDK 2.2 continues. Hosted build now fails with the following error:

The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll". Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll' or one of its dependencies. The system cannot find the file specified.

While my Polish is non-existent, the answer can be found at The project templates for the web and worker role projects uses ToolsVersion=”12.0”. This needs to be changed to ToolsVersion=”4.0” for hosted build to be successful.

Read More

VS2013 won’t start debugging

I hit this one a couple of days ago and it had me scratching my head for a while.
The debugger cannot continue running the process. Unable to start debugging.

I thought it was an issue with the tooling, perhaps something I uninstalled or installed. I had installed VS2013 with Azure SDK 2.1, then updated with 2.2 when it came out but I had also uninstalled some packages related to VS2010 which I have used for years.

Turns out that this error presents itself when the solution doesn’t have something to debug. The message is a little misleading though.

My solution starts multiple projects on F5. One project is an Azure cloud project with web and worker roles (debugger attached) while the other is a local STS website (no debugger attached), all of which run in IIS Express. This error popped up when there were either no projects set to run or when the STS project was set to launch without the debugger and the cloud project was set to None for the multiple project start. Either of these cases causes VS not to debug because there is nothing that is configured for it to attach too.

Read More

Azure SDK 2.2 with IIS Express 8.0 not supporting configSource like previous version

I have upgraded a decent sized solution to Azure SDK 2.2, VS2013 and most of the latest bits (still MVC4 though). All of a sudden the web role is not serving any content. In fact the web role can’t even start and the Application_Start method never gets invoked. IIS Express 8.0 only renders the following content:

The page cannot be displayed because an internal server error has occurred.
Read More

Headless 1.0.103 Released

I’m super excited to announce the first release of Headless, a HTTP acceptance testing framework. It makes GET and POST calls and provides a framework for interacting with HTML pages. Oh, and it is super fast.

I have completed converting the acceptance test suite an enterprise web application from WatiN to Headless. The test suite has around 360 tests of which only about 6 could not be converted to Headless. The execution time of the test suite dropped from 1:04 hours down to just over 7 minutes. Yeah, it’s fast.

Read More

HttpUtility.HtmlAttributeEncode does not encode > characters

I’ve been working on a side project that works with HTML responses from websites when I hit an issue when authenticating to a development STS that uses WIF. I found that WIF uses HttpUtility.HtmlAttributeEncode to dynamically generate a form that contains auth information in a hidden field. The auth information is XML but the form does not get processed correctly by some custom code because the HTML is invalid.

So my debugging efforts seem to have uncovered an issue in HttpUtility.HtmlAttributeEncode (or more specifically the HttpEncoder class).

Read More

Deploying websites with WiX

I posted back in 2010 about how to get WiX to correctly deploy a website using harvesting. It was a rather clunky solution that required changes to your development machine (and the same for everyone in your team) as well as any build infrastructure you are running. I have now discovered a much cleaner solution using harvest transforms (tested using WiX 3.7).

As a recap, harvesting pulls files from the project reference compilation into the MSI and puts them into a single output directory. This means that website content and the binaries will be in the root folder of the deployment. This is no good for websites that require binaries to be placed into a bin folder.

Read More

Configuration for NewRelic Azure Nuget package

I’ve previously posted about Nuget package update pain with the NewRelic Azure package (here and here). I’ve had issues again when updating to the latest version. This time I’ve added in a Worker role and found that the PowerShell script that installs the package did not configure the Worker role. I have gone through the PowerShell scripts to manually ensure that the configuration files match what they should be.

Read More

Insight.Database with Unity integration

One of my favourite development packages to use over the last year has been a micro-ORM called Insight.Database written by Jon Wagner. Version 2.1 of this excellent package comes with automatic interface implementations so you don’t even have to write DAL classes anymore.

I haven’t been able to play with this feature until the last week. One of the roadblocks was that I use Unity as my IoC for dependency injection which does not natively support injecting these types of instances. What I need is to be able to configure a Unity container to return an auto-implemented interface in a constructor. I have created Unity extensions before for injecting ConnectionStringSettings, AppSettings and RealProxy implementations so creating one for Insight.Database should be simple. The RealProxy Unity extension was very similar to what I need as the logic is just about the same.

Read More