Session State being lost in Web Farm

Investigating and issue with session data being lost on a load balance ASP.Net website the other day, users we''re losing items from a basket when bouncing between servers.

These issues have always been difficult to investigate but it turned out that when setting up the web servers there was multiple sites in IIS. These has been created in different order so had ended up with different site ids. A simple error but the symptoms were dramatic for users and difficult to recreate and trace.

This article details the issues https://support.microsoft.com/en-us/kb/325056 , although I did not have to use the described resolution.

I found that I could just change the site id through IIS, if a another site had the required id I renamed that until both web servers were is sync.

In IIS select the site and advanced settings; the edit the id to the required value




Hyper-V Virtual Machine Copy

I needed to evaluate a several database tools against an application I was writing,  so it made sense to create VM with the application and then copy it. Looking into Hyper-V  there was no option to clone a Virtual Machine without puchasing a tool. 

Looking at google there were two options;

  1. Copy the virtual hard disk in file explorer and then create a new VM using the Hyper-V wizard and point to the copied VHD when setting up the disk
  2. Export the VM and then import as a new VM using the import export tool.

The following steps are how to do option 2 , note that this operation can only be performed once for each export. The export files can only be imported once, if you need to do multiple copies you will need to do another export for each import.

In the Hyper-V Manager

1 - Chose Export for the right hand side menu



2 - Select a location for the export files to go, this is a temporary location as once imported the directory will remain but cannot be used again.




3 - The export can take a while .....



Importing the exported Virtual Machine

1 - In the Hyper-V Manager select ''Import a Virtual Machine''


2 - Select the folder where the exported Virtual Machine files were placed, selecting the top level folder is ok


3 - Select the location for the new Virtual Machine to be created, note you will need to change these values as they will be the same as the original machine and it will attempt to overwrite.



4 - It is important to select ''Copy the virtual machine'' otherwise it will overwrite the original machine, the import can take a while.



5 - The imported VM will appear to have a duplicate name, this can be changed by right clicking on the name and changing to the required name


Once complete the VM can be started and used and is an exact copy of the original, this was ideal for the scenario as the evaluation was using trail period software and the VM''s were only required for a few days.