Umbraco: An unexpected network error on Azure Web Apps

So i've had an ongoing issue with Umbraco sites randomly failing (500 Errors) in Azure when setup as Web Apps.

I have managed to find a solution for this, the Examine Index needs to be stored in the %temp% folder, otherwise the indexes get removed / corrupted everytime something in the bin folder changes.

The recorded error should be similar to below:

Exception type: IOException Exception message: An unexpected network error occurred. at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, CacheDependency dependency) at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, String[] dependentFiles) at Umbraco.Core.Cache.DeepCloneRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, String[] dependentFiles) at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.GetCacheValues(Int32 id, Func2 func) at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.GetUmbracoMedia(Int32 id) at Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.GetById(UmbracoContext umbracoContext, Boolean preview, Int32 nodeId) at Umbraco.Web.PublishedCache.ContextualPublishedCache1.GetById(Boolean preview, Int32 contentId) at Umbraco.Web.PublishedContentQuery.DocumentById(Int32 id, ContextualPublishedCache cache, Object ifNotFound) at Umbraco.Web.PublishedContentQuery.Media(Int32 id) at Umbraco.Web.UmbracoHelper.Media(String id)

The solution i have found for this, is pretty quick and easy to do, simply open the config/ExamineSettings.config and add the following on to the examine config lines:

useTempStorage="Sync"

Pretty simple fix :)

(You can see the Umbraco Pull Request here)

How to identify PID of AppPools

I thought i would reshare how to find the PID of an AppPool, as it's not the easiest thing to find if your not familiar with the process.

This allows you to map the w3wp process to the AppPool that you are trying to diagnose.

Step1 - Open IIS Manager, go to the root node in the tree on the left that represents your computer (should be labelled as your computer name)
Open IIS Manager

Step2 - In the features view to the right, you'll see a section called IIS. Under that you'll see Work Processes.
Worker Processes

Step3 - Select that and it should show you all running worker processes and some basic info, including Process ID (PID)
Process ID (PID)

Step4 - You can map that Process ID to the matching process in the Process tab in Task Manager.

This is a repost, the original post can be found on the MSDN Blogs here.

Save 20% on G Suite Basic or Business

Using one of my codes below you can save 20% off the first year of G Suite Basic or G Suite Business.

(These codes are on a first come first served basis)

My Referal Link (You must use this link for the codes to work):

https://goo.gl/45AhYh

Then use one of the following codes:

G Suite Basic Plan (20% off first year):

T9VL9673MF6KYX3

G Suite Business Plan (20% off first year)

AC44VKTGKGUYXNJ

Code highlighting the easy way

So after relaunching this site using Umbraco and the default Bootstrap 4 theme (blog) i realised there was no <code> highlighting included in bootstrap.

After some quick Googling i came across a very useful JavaScript library called highlight.js this library is able to auto match up to 176 languages and colour code them accordingly.

This seemed pretty nifty and much easier than codiing a ton of css myself.

To implement this you just need to add 3 very small lines into the <head> if the site:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Then wrap your code with the following:

<pre><code>...</code></pre>

If the auto highlighting doesn't work or you would like to use a different style you can manually set it like so:

<pre><code class="html">...</code></pre>

Or if you would like to disable code highlighting altogether:

<pre><code class="nohighlight">...</code></pre>

This is just a real basic implementation of this JavaScript library, take a look over on the project website to see about custom initialization, downloading the library and creating a custom library.

 

Custom WordPress Installer for Virtualmin GPL

This WordPress installer for Virtualmin has been doing the rounds online for years, but it is slowly disappearing, so I figured I would post it here for easy access.

I have made some minimal changes so that is downloads the latest version from WordPress and checks for PHP7 and PHP5

Download here:
https://aaronsadler.uk/custompress.pl

Install it here:
/usr/libexec/webmin/virtual-server/scripts/

Then, login to Virtualmin -> Installer Scripts and there will be "Wordpress" option