More and more of our clients are running their websites in the cloud. Some are harder to convince to make this leap and some just want to go all in. Far too often there are issues that come up which cause clients to rethink their move. We're here to help with those shaky times and make the transition as smooth as possible. But there are going to be times when you just throw your hands up in the air and scream. This, was one of those times.
Flash back about 3 months ago. A 9.0.8 Kentico site has been running great in Azure as a Web App for the last 6 months. In early February, the client started complaining about the site taking a long time to load when they logged into Kentico. After some research, I found there was an issue with the scheduler causing an infinite loop. The simple fix is to apply a hotfix and move the client up to v9.0.50 (weren't ready for the jump to v10 yet).
With the hotfix applied locally, we got it deployed to a dev environment for testing and eventually deployed to production. Needless to say, all was good. Things went very smooth until 2 days after go live. I noticed the dev environment was erroring out every now and then. Simple fix was to restart the website in Azure. Not long after that, I received some upset calls and emails from the client and stating they were no better off now because their site was going down. Remember what I said about trying to make transitions as smooth as possible?
Jump forward to 3 weeks ago, after a lot of research in the event log, within the Azure event log and the DevNet, I gave in and contacted Kentico Support. Sure enough, after about an hour I got an email back with a few questions and a simple solution. Read on for more of the problem, the exact error and how to fix it.
The problem was very random so very hard to pinpoint exactly what caused it or when it would happen. It was pretty easy to see the errors within Kentico event log and Azure Portal. But like most errors, unless you write them, the error wasn't very descriptive. The nice part is it did give some hints and clues!
Most times the site went down I wasn't able to log into Kentico so I'd simply restart the website within the Azure Portal and things would resolve themselves, for a while. When I was able to get into Kentico admin interface I found several of the same errors talking about "an unexpected network error occurred" and a few lines about "System.IO" and more importantly references to "FiftyOne.Foundation.Mobile.Detection".
Ever come across this error before in your Kentico install?
Message: An unexpected network error occurred.
Exception type: System.IO.IOException
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.ReadCore(Byte buffer, Int32 offset, Int32 count)
at System.IO.FileStream.Read(Byte array, Int32 offset, Int32 count)
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at FiftyOne.Foundation.Mobile.Detection.Entities.Node..ctor(DataSet dataSet, Int32 offset, BinaryReader reader)
at FiftyOne.Foundation.Mobile.Detection.Entities.Stream.NodeStreamFactoryV32.Construct(DataSet dataSet, Int32 offset, Reader reader)
at FiftyOne.Foundation.Mobile.Detection.Entities.Stream.BaseList`1.get_Item(Int32 key)
at FiftyOne.Foundation.Mobile.Detection.Entities.Stream.CacheList`1.get_Item(Int32 key)
at FiftyOne.Foundation.Mobile.Detection.Entities.Node.GetCompleteNode(Match match)
at FiftyOne.Foundation.Mobile.Detection.Controller.Evaluate(Match match)
at FiftyOne.Foundation.Mobile.Detection.Controller.Match(Match match)
at FiftyOne.Foundation.Mobile.Detection.Provider.MatchNoCache(String targetUserAgent, Match match)
at FiftyOne.Foundation.Mobile.Detection.Provider.Match(String targetUserAgent, Match match)
at FiftyOne.Foundation.Mobile.Detection.Provider.Match(NameValueCollection headers, Match match)
at FiftyOne.Foundation.Mobile.Detection.WebProvider.GetMatch(HttpRequest request)
at FiftyOne.Foundation.Mobile.Detection.MobileCapabilitiesProvider.GetBrowserCapabilities(HttpRequest request)
at System.Web.Configuration.HttpCapabilitiesBase.GetBrowserCapabilities(HttpRequest request)
at System.Web.Security.CookielessHelperClass.UseCookieless(HttpContext context, Boolean doRedirect, HttpCookieMode cookieMode)
at System.Web.Security.FormsAuthenticationModule.ExtractTicketFromCookie(HttpContext context, String name, Boolean& cookielessTicket)
at System.Web.Security.FormsAuthenticationModule.OnAuthenticate(FormsAuthenticationEventArgs e)
at System.Web.Security.FormsAuthenticationModule.OnEnter(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Well it seems in Azure there is an issue with enabling the 51degrees.mobi features. Problem is, they are enabled by default when you install Kentico. AND the 51degrees library doesn't have proper handling when the 51degrees.dat file is locked in the /App_Data/51Degrees directory. Keep in mind we're not using web farms, just a single server. If we were using web farms, these files could be stored off in blob storage and you might never see this issue.
If you haven't already, simply disable the 51Degrees module in Settings>Integration>51degrees.mobi. Most sites are responsive now and aren't using the device detection solution anyway so why have it enabled?
Hope this helps someone else having the same type of problem!
Good luck and happy coding!