find a location for property in a new city

Tuesday, 29 November 2011

Conflicting versions of ASP.NET Web Pages detected

I was going through the Windows Azure Platform Training Kit, Exercise 1 of the Service Bus Messaging lab and I ran into the following error message when trying to run my site, "Conflicting versions of ASP.NET Web Pages detected: specified version is "", but the version in bin is "". To continue, remove files from the application's bin directory or remove the version specification in web.config."

I checked the web.config and the assembly specified was indeed <add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />.

When I checked the System.Web.WebPages reference in my project though it also said its version is So what's the problem?


The assembly System.Web.WebPages.Deployment was referenced in my project and on closer inspection it was version so it must be this which is causing the problem. I do not need this assembly though so I deleted it and the error went away.

Follow britishdev on Twitter

Monday, 28 November 2011

Service 'SQL Azure Data Sync Preview' failed to start

While trying to install and start the SQL Azure Data Sync Preview Service I ran across the error message "Service 'SQL Azure Data Sync Preview' (SQL Azure Data Sync Preview) failed to start. Verify that you have sufficient privileges to start system services." Here are the step I had to take to make it start working.

You have to get all of these right to be able to install and start the service successfully. Most are not very obvious and the final step I seem to be the only person on the internet with this problem (hence the blog post)! Anyway, here goes:

Get your username and domain right

Although it says you can enter the account with examples of "domain\user, .\localuser", you can't; it is a lie! You should ensure that you fill out the "User Name" field like MACHINENAME\Username. So MYMACHINE\Colin if you were me.

Verify you have sufficient permissions

Your user may not have permission to log in to Windows Services so you need to make sure you can.

Go to:

  • Control Panel > Administrative Tools > Local Security Policy
  • Open Local Policies > User Rights Assignment
  • Click on Log on as a service
  • Click "Add User or Group..."
  • Set location to your machine
  • Type your user name into the box and click OK then Apply

Ensure you have a password

This was the problem I ran into. The installation just didn't seem to complete because my Windows user did not have a password. I Ctrl + Alt + Del > Change password. I gave myself an actual password rather than leaving it blank which I had done in the past. It then installed without a hitch.


So quite a few snags you may run into when installing the Data Sync service but hopefully with my little check list it wont take you as long as it took me. I'm guessing these sort of bits are just a symptom of the service being in Preview not RTM so they are understandable really.

For what it's worth the preview of SQL Azure Data Sync is a great service, installing this Windows Service was the only issue I had in an otherwise simple process. The benefits of using the service are great, you can sync multiple databases both inside or outside of the Azure data centres. You will only get charged for data leaving the data centre too so any SQL Azure to SQL Azure synchronisation within the same data centre is free! Well, free for now anyway since it is still in preview so I'd keep an eye out when it becomes production ready. Happy syncing!

Follow britishdev on Twitter

Tuesday, 22 November 2011

Share admin login with LiveID in the Azure Management Portal

Has this happened to you? Someone else signed up to use Windows Azure and you are the one who is working on it. You want to access this Azure Portal with a different LiveID? Your LiveID?

Let me guess - your CTO/director decided that Azure is awesome and signed up for its free trial. He had a click around and then quickly passed it on to you, the developer, to work on it. Now you are getting irritated having to remember the new weird LiveID and password and you are tired having to log in and out of your other applications that use your LiveID.

Then the way forward is for you to add a Co-Admin to the Azure Portal. This will allow you to log in with your LiveID that you are used to.

Add new Co-Admin to your Azure account

In your Azure Management portal:

  • Go to the "Hosted Services, Storage Accounts & CDN" tab.
  • Then click "User Management".
  • Click "Add New Co-Admin".
  • Type in your LiveID and select the subscription they can administrate.

Your new LiveID is now added to the list of users and should be a Co-Administrator which has all the power you need to manage the technical side of your available subscriptions.

Follow britishdev on Twitter

Monday, 21 November 2011

Two host names appearing on Google for the same site

If you have an application hosted in Window's Azure your application will have a host name such as You will probably also have a CNAME that points to the cloudapp. So what if both domains have been indexed by Google? How do you get URL off of Google?

This is not a problem with Windows Azure; this can happen to any site that has two hostnames/IPs that point to the same site. It is just a recurring issue I see during my Azure consultancy work and worth a quick explanation and solution.

Both and are pointing to the exact same application and servers so there is no way you can switch one off since they are one and the same, just accessible through two paths. (Well, more than two since they will at least have IP address paths too.)

This issue can be solved in your application code. Your application will need to determine what host name the application has been accessed through and either display the page if the host name is correct or 301 redirect to the correct hostname if the host name is wrong. So how to do it?

301 Redirect to your correct domain

This can be done in your application by setting a redirect rule using the IIS URL Rewrite Module. There is already a template in IIS's Rewrite Module for doing this called "Canonical domain name" under the SEO section, however I don't particularly like this one since it redirects everything that isn't the correct hostname (e.g. your development machine). Still, you should have a look at it to see what it is doing.

The key steps of what your rule should be doing are:

  1. Check to see if the host name is incorrect
  2. If it is it should issue a redirect to the correct domain name
  3. The redirect should be a 301
  4. The page should remain e.g. ->
  5. If the host name is not in violation the page rendering should continue without further action

So you can make your own however you feel is best but here is my example to get you going.

        <rule name="CanonicalHostNameRule1">
            <match url="(.*)" />
                <add input="{HTTP_HOST}" pattern="^mysite\.cloudapp\.net$" negate="false" />
            <action type="Redirect" url="{R:1}" />

This code goes in the <system.webServer>...</system.webServer> section of your web.config. Again this is only an example, you may wish to add another condition for handling your IP address for example.

This redirect will solve the problem of any users visiting the incorrect site. Also, because it is a 301 redirect, over a week or two Google will remove the URL from its search results and attribute its existing value to the correct URL.

Follow britishdev on Twitter

Monday, 14 November 2011

VIP swap with different endpoints in Azure

Attempting to Swap VIPs from the Azure Management Portal can return an message "Windows Azure cannot perform a VIP swap between deployments that specify different endpoint ports" when trying to Swap VIPs between a staging and production environment with different endpoints.

Say you have a web role deployed to Azure and it is currently in production. It has one instance and one endpoint of http on port 80. You then publish a new web role to staging that is also one instance but this time it has an https endpoint on port 443.

Both will work as usual however when you come to swap the VIPs over you will recieve the error "Windows Azure cannot perform a VIP swap between deployments that have a different number of endpoints" preventing you from putting your new site into production.

Is there a way around this?

I tried a few different tactics. I tried doing a straight upgrade to production (since I have tested the same deployment in staging) but this failed for the same reason as above.

I tried changing my new package to have the original http endpoint on port 80 as well as the new endpoint on port 443. This didn't work either. All this experimenting takes time so I thought I would save you the hassle and just tell you that neither of these work!

The only way(?)

The only way I found to get your new site into production is (you guessed it) delete the old site that is to be replaced (scary!), and then click "Swap VIP". You will experience down time for somewhere between 2 and 3 minutes so pick the least destructive time to do this.

Note: Please please test the new site that on staging thoroughly as you just deleted the production package and so it will take a long time to get back!

Follow britishdev on Twitter

Thursday, 10 November 2011

Cannot create database 'DevelopmentStorageDb20110816' in Storage Emulator Azure SDK

I have uncovered this problem before and this time I thought I would spend the time to crack it. When running the Storage Emulator from the Azure SDK or running DSINIT.exe for the first time it needs to initialise; part of this involves creating a new database. This was not running correctly due to a permissions problem which stated "Cannot create database 'DevelopmentStorageDb20110816' : CREATE DATABASE permission denied in database 'master'".

The full report is as follows:

Added reservation for in user account MSFT-123\MyUser.
Added reservation for in user account MSFT-123\MyUser.
Added reservation for in user account MSFT-123\MyUser.

Creating database DevelopmentStorageDb20110816...
Cannot create database 'DevelopmentStorageDb20110816' : CREATE DATABASE permission denied in database 'master'.

One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. These errors can occur if SQL Server was installed by someone other than the current user. Please refer to for more details.

Grant permissions

The user this program is running as must be a sa with full permissions on the database. If this is not the case you can either change the user or GRANT permissions to the current user.

To change the user run the Windows Azure SDK Command Prompt (as administrator) and type 'DSINIT /?'. This will give you details on how to change user, which is to use the /user: argument.

Alternatively you could GRANT the permissions to your default user like so:

USE master

Either of these solutions should solve your permissions problem with DSINIT.

Cannot GRANT permissions

Unfortunately my problems went further than this still. I believe this is to do with how many times I had installed a SQL Server Express in the past. How irritating is that?! You own the machine and yet you don't seem to have the permissions that reflect that!

Anyway, the solution to make this work once again was (unfortunately) to uninstall SQL Server Express and reinstall it again. This way you will be the owner of the SQL Server Express database engine and you will be able to create all the databases you wish, including your long awaited Storage Emulator database.

A better way to regain admin access

A better way to regain admin access was pointed out to me by a colleague, Michael Coates. You can either solve this loss of administrator on a SQL server by following this troubleshooting guide from MSDN (this worked for one commenter). Or you can run a batch script that will magically do it for you (this didn't work for one commenter). I have not done either of these so take this advice at your own risk. Remember, my way was to delete and reinstall the server so this cannot be more risky, surely?

Follow britishdev on Twitter

Tuesday, 8 November 2011

Cross database joins in SQL Azure

Currently cross database joins are not supported in SQL Azure. Also you cannot change database mid query so you cannot, for example, put a USE [MyDB] in your query either. As a side note, please vote for it to be a priority feature for the SQL Azure team to develop soon.

So, since cross database joins are not supported at this time you must find a workaround. I will give you two possible solutions I would recommend and you can hopefully choose the one that is best for your application.

Combine your databases

If you have tables that are frequently used together, i.e. they are joined in queries or the rows are inserted in the same transactions, then it would be a good idea to move the similar tables into the same database. This of course eliminates the need to traverse databases. SQL Azure has very recently increased the maximum database size from 50GB to 150GB, which potentially makes this a more viable option than perhaps it once was.

Join your data in your application

Two separate queries could be run on the two separate databases and then these results could be joined within that application. Obvious downsides to this will be the potential for large DB I/O, large network transfer and large memory usage in your app. This is not something to consider if the amount of data that is likely to be returned is large (e.g. 1000+ rows) but it is fine if the data will be manageable.


Personally I would much rather settle for bringing all my similar tables that are likely to be used within the same queries together into one database so there is no longer a need for cross database solutions. This makes for cleaner application code and more efficient use of your resources. However, if this option is not available to you then perhaps the second option may have to be the one you choose.

Surely soon in the future the SQL Azure team will address this issue though and your cross database code can stay clean! Although in fairness cross database querying isn't even available in Entity Framework yet (but still workaround-able) either. I wonder why this is so difficult for Microsoft? Just shows you should always try and combine similar DBs in any database designs where possible.

Follow britishdev on Twitter

Monday, 7 November 2011

"The Web Platform Installer could not start" fix

I was trying to download the Azure SDK version 1.5 and I was experiencing issues preventing the install because the Windows Platform installer could not load up and run properly. It instead opened a error message saying "The Web Platform Installer could not start. Please report the following error on the Web Platform Installer Forum. http:/".

The problem was that the Web Platform Installer needed to update but could not seem to manage it. This was causing the error to display and then crash without allowing me to install the original Azure SDK I was actually trying to install.

Microsoft Fix It fixed it

Microsoft Fix It is a tool from Microsoft that automatically finds the particular one you want in this scenario is the Diagnose and fix program installing and uninstalling problems automatically.

To do this download it and use it as follows:

  • When the option to select "Detect problems and let me select the fixes to apply." appears, do that.
  • say you are having a problem with "Installing"
  • After a short wait scroll down to find "Microsoft Web Platform Installer 3.0" (or which ever version number you have) and select that.
  • Next you should click "Yes, try uninstall" then click next and follow the instructions.

This should solve your issue with the Microsoft Web Platform Installer and allow you to install the Azure SDK or whatever it is you're trying to install.

Follow britishdev on Twitter