Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin 5 posts 85 karma points
    Feb 23, 2023 @ 16:58
    Kevin
    0

    Azure App Service Redirect Issue

    My client site is on Umbraco V10.4.0 and hosted on an Azure App Service with an Azure SQL database.

    The client has requested that we redirect from the www. domain to the none www domain.

    The client has also requested that we redirect from the Azure default domain (https://clientname.azurewebsites.net) to the clients main domain.

    I have added the necessary redirects to the web.config in the normal way, and deployed the config file to the app service and the redirects work perfectly for a period of time - usually around 1 hour - at which point the app gets a 500 Server Error.

    This error will go if I restart the app service, but then reappear after a period of time.

    If I remove the redirects and redeploy I no longer get any 500 Server errors.

    Looking into the Umbraco log viewer I see the following errors repeated a number of times.

    enter image description here

    Looking at the detail of the error we see the following:

        System.IO.IOException: The process cannot access the file 'C:\home\site\wwwroot\umbraco\Data\TEMP\NuCache\NuCache.Content.db' because it is being used by another process.
       at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
       at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
       at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
       at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
       at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
       at CSharpTest.Net.IO.TransactedCompoundFile..ctor(Options options)
       at CSharpTest.Net.Storage.BTreeFileStoreV2..ctor(Options options)
       at CSharpTest.Net.Collections.BPlusTree`2.OptionsV2.CreateStorage()
       at CSharpTest.Net.Collections.BPlusTree`2.NodeCacheBase..ctor(BPlusTreeOptions`2 options)
       at CSharpTest.Net.Collections.BPlusTree`2.NodeCacheNone..ctor(BPlusTreeOptions`2 options)
       at CSharpTest.Net.Collections.BPlusTree`2..ctor(BPlusTreeOptions`2 ioptions)
       at CSharpTest.Net.Collections.BPlusTree`2..ctor(OptionsV2 optionsV2)
       at Umbraco.Cms.Infrastructure.PublishedCache.DataSource.BTree.GetTree(String filepath, Boolean exists, NuCacheSettings settings, ContentDataSerializer contentDataSerializer)
       at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.MainDomRegister()
       at Umbraco.Cms.Core.Runtime.MainDom.Register(Action install, Action release, Int32 weight)
       at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.<EnsureCaches>b__52_0()
       at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
       at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
       at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.EnsureCaches()
       at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.CreatePublishedSnapshot(String previewToken)
       at Umbraco.Cms.Web.Common.UmbracoContext.UmbracoContext.<>c__DisplayClass11_0.<.ctor>b__0()
       at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
       at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
       at System.Lazy`1.CreateValue()
       at System.Lazy`1.get_Value()
       at Umbraco.Cms.Web.Common.UmbracoContext.UmbracoContext.get_PublishedSnapshot()
       at Umbraco.Cms.Web.Common.UmbracoContext.UmbracoContext.get_Domains()
       at SeoToolkit.Umbraco.Redirects.Core.Services.RedirectsService.GetByUrl(Uri uri)
       at SeoToolkit.Umbraco.Redirects.Core.Middleware.RedirectMiddleware.HandleRedirect(HttpContext context)
       at SeoToolkit.Umbraco.Redirects.Core.Middleware.RedirectMiddleware.Invoke(HttpContext context)
       at SeoToolkit.Umbraco.Sitemap.Core.Middleware.SitemapMiddleware.Invoke(HttpContext context, ISitemapGenerator sitemapGenerator, ISitemapIndexGenerator sitemapIndexGenerator)
       at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
    

    I have removed an Azure STAGING deployment slot to ensure that this was not causing the issue.

    Can anyone offer any insight or previous experience of this issue on Azure?

    Thanks,

    Kevin

  • Conor Howe 36 posts 137 karma points
    Feb 24, 2023 @ 15:03
    Conor Howe
    0

    Hi Kevin,

    Out of interest have you done all the required configuration changes for hosting in Azure?

Please Sign in or register to post replies

Write your reply to:

Draft