umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.4k stars 2.66k forks source link

Issue on Migrating an application to Azure - System.TimeoutException: Cannot acquire MainDom at Umbraco.Core.Runtime.MainDom.Acquire() #14271

Closed fenildesai closed 1 year ago

fenildesai commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

8.17.1

Bug summary

Hi - I am trying to migrate an application using Umbraco 8.17.1 from on prem to Azure. I have migrated the DB in Azure to SQL MI. Deployed the app to Azure, updated the connection string with the SQL MI one.

Even updated the connection string with Authentication=Active Directory Managed Identity, but still getting the below error:

-> Umbraco.Core.Exceptions.BootFailedException: Boot failed.

-> System.TimeoutException: Cannot acquire MainDom at Umbraco.Core.Runtime.MainDom.Acquire() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) at Umbraco.Core.Runtime.MainDom.get_IsMainDom() at Umbraco.Core.Runtime.CoreRuntime.AcquireMainDom(IMainDom mainDom) at Umbraco.Core.Runtime.CoreRuntime.Boot(IRegister register, DisposableTimer timer)

After checking the logs, error seems to be as below:

Unable to resolve type: Umbraco.Core.Services.ServiceContext, service name:

Specifics

No response

Steps to reproduce

Deploy an ASP.NET application to Azure with Umbraco nuget packages.

Expected result / actual result

No response

github-actions[bot] commented 1 year ago

Hi there @fenildesai!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

kjac commented 1 year ago

Hi @fenildesai,

Thanks for reaching out 😄

All Umbraco versions can be deployed to Azure, including V8.x. It sounds like you have an issue with your configuration or the provisioned Azure resources - possibly connectivity issues between your web app and the DB.

First and foremost, please ensure that you have followed this guide to configuring V8 for Azure deployment.

If that does not yield any clarity, I would urge you to try out a minimal setup and see if that works - i.e. deploy to a web app use an Azure SQL Database (instead of the Azure SQL Managed Instance). Or even simpler, run the site locally against an Azure SQL Database.

If you're still not having any luck, try creating a brand new V8.17.1 project and deploy that to Azure. That should definitively work. Then you can compare configurations, custom startup code etc. to see where your issue occurs.

I'm going to close this issue for the time being, as I do not believe it to be an issue with Umbraco itself. If you find yourself entirely unable to deploy a brand new V8.17.1 project to Azure, please feel free to reopen the issue with steps to reproduce.

For good measure I'll also refer you to the good people at the forum if you need help with answers i.e. to configuration.

fenildesai commented 1 year ago

Thanks @kjac for the response. I initially tried the forum - https://our.umbraco.com/forum/using-umbraco-and-getting-started/111874-migrating-umbraco-application-to-azure but since didn't got much response, so thought to put something here as I had tried multiple options as per this guide but it doesn't seem to work.

Just wanted to check if Umbraco would work with SQL MI or does it need Azure SQL only?

kjac commented 1 year ago

Hi @fenildesai,

To be honest I have never tried using SQL MI. If it is feature compatible with SQL Server, it should work. If it worked with V8 on prem, it should work in Azure too. However, I can't say for sure.

From your issue description it does sound like there is a connectivity issue. I suppose your best bet is to try to connect from your local machine to your Azure DB and get that to work before moving further. Or of course go with Azure SQL.

fenildesai commented 1 year ago

Hi @kjac - I have checked by tcpping from the Azure App service to the SQL MI instance and it is connecting fine.

Other thing to note is if i remove the umbracoDbDSN connectionstring from the web config then it displays page asking to Install Umbraco 8. So not sure where the issue is. We are using SQL MI with Authentication=Active Directory Managed Identity.

Also not able to get to the Umbraco logs on Azure.