Slow Azure websites with Redis

During a load test of an Azure website, we noticed that the site started to become unresponsive when 10 concurrent users we loaded.

Session management has been utilized through a Redis cache. For anyone looking to use this I would recommend here as a good starting point.

Deploying the site locally using the live web.config transforms, we were able to run the following in the command line, to show all connections that were being made from the computer.

netstat -b

It was noticed that there were over 100 concurrent connections being made to the cache which stopped the site from being able to connect to the azure portal.


The azure portal had displayed the following recommendations to fix the portal



This was due to the concurrent connections being maxed out a 256 connections.


What was the culprit? Creating a new connection every time the class was instantiated.

It is recommend in the by MSDN to create a static instance of the connection that is shared across the application. This can either be achieved by using a singleton pattern, using dependency injection or by using the below code.

private static Lazy _redisConnection = new Lazy(() => 

This then happened.



Azure search – Scoring profiles

A scoring profile allows Azure search to target and favor a combination of columns when searching for content.

Searching without a scoring profile lets Azure search calculate a score based on what it thinks the best match is. This produces a score against the search result and tells your what the most relevant item is.

To create a scoring profile, first log into the Azure portal and find the Azure search block and select the index of choice.

The opening blade will show you all of the properties of the index, including all of the scoring profiles. This is at the bottom.

Available scoring profiles

Click the “Add scoring profile” button at the top


name the new profile and a new profile will open in the blade


Click on the weights button and select the filed and weighting against that field. The weights are between 0-10



Save the profile to close the blade. In the prevous blade, click “Set as default” which will set the scoring as a default item. This means any search performed against the index will be run through this to ensure the results you are expecting match the criteria.

Umbraco with https on Azure and scheduled published tasks

When forcing a site to run on HTTPS, the following rule is set in the web.config to force a site to 301 redirect to HTTPS when a HTTP link is found

  <rule name="Redirect to https" stopProcessing="true">
 <match url="(.*)" />
 <add input="{HTTPS}" pattern="off" ignoreCase="true" />
 <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />

Whilst initial test will force the site to redirect to HTTPS, not all requests made from umbraco will execute using just this. We also need to ensure that the following key is also set

<add key="umbracoUseSSL" value="true" />

You must also make sure that set the location of the Umbraco endpoint in the umbracoSettings.Config

 internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"

This will ensure that all requests made from umbraco to /umbraco/RestServices/ScheduledPublish/Index will be sent via HTTPS in the first instance.

When this is not set, a HTTP request is made which will result in the error

A public action method ‘Index’ was not found on controller ‘Umbraco.Web.WebServices.ScheduledPublishController’.

The error indicates that a request has been made via HTTP and redirected to HTTPS which has been rejected.

Once the App Setting has been set, the error will resolve.


Searching Collection(Edm.String) with oData in .net

Azure search allows for an array of strings to be stored against a record.

You can set up the field either by creating it directly in the azure portal, or creating a property and adding the following attributes.

[IsSearchable, IsFilterable, IsFacetable]
 public string[] Category { get; set; }

The IsFilterable  must be set, otherwise the framework will throw an exception

The .net SDK gives the option to set search parameters when making a query which translates into a HTTP request using the oData syntax.

The documentation shows how to find a single item in the list, but not multiple options in the same list. To search for options 1 or 2 or 3 in the Category property, the filter will need to be formed as follows

$filter=(category/any(c: c eq '1') or category/any(c: c eq '2') or 
category/any(c: c eq '2'))




umbraco 7.4.1 and azure blob storage


Azure Blob storage Module

As part of the 7.4.1 upgrade, Umbraco have changed the way in which images are stored in the database. In previous version of the Core, images were served as absolute URLs to the media item, however, these are now stored as a JSON object.

Stored without image focus points

{"src": "", crops: []}

Stored with image focus points

  "focalPoint": {
    "left": 0.5,
    "top": 0.5
  "src": ""

After upgrading there maybe instances where your local image library has lost the image thumbnails when trying to attach an image using the media picker. This is due to the upgrade process not modifying the old data to the new column. In the cmsPropertyData table, DataNvarchar was still populated with a physical URL to the image an

If the image wasn’t in the correct URL format, it would fall back to using

As the image isn’t local to the project, the url could not be used to generate a thumbnail.

Settings > Media Types > Image > Upload Image > change type to Image Cropper

Running the SQL below, should format the urls into the required format to be able to view the images.

UPDATE cmsPropertyData 
SET cmsPropertyData.dataNtext = Formatted.dataNtextCol
	SELECT TOP(1000),cmsPropertyData.propertytypeid, cmsPropertyData.contentNodeId, '{"src": "' + cmsPropertyData.dataNvarchar  + '", crops: []}' as dataNtextCol
	FROM cmsPropertyData
	WHERE (cmsPropertyData.propertytypeid = 135 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' AND dataNtext is null) 
	   OR (cmsPropertyData.propertytypeid = 6 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' and dataNtext is null)
	   ORDER BY cmsPropertyData.contentNodeId
) as Formatted

UPDATE cmsPropertyData 
SET cmsPropertyData.dataNvarchar = NULL
	SELECT TOP(1000), cmsPropertyData.propertytypeid, cmsPropertyData.contentNodeId, '{"src": "' + cmsPropertyData.dataNvarchar  + '", crops: []}' as dataNtextCol
	FROM cmsPropertyData
	WHERE (cmsPropertyData.propertytypeid = 135 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' AND dataNtext is not null) 
	   OR (cmsPropertyData.propertytypeid = 6 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' and dataNtext is not null)
	    ORDER BY cmsPropertyData.contentNodeId
) as Formatted