This project is read-only.

Database Migrations don't run in Azure Websites

Topics: Writing modules
Dec 2, 2013 at 5:16 PM
I'm looking for ideas how to troubleshoot this.

I developed a very simple Content Part as a new Module. I am able to run the module locally without any problems (locally, I'm using SQLCE) but when I deployed the module to my Orchard instance in Azure Websites the Migrations don't run and the content part is not available. The feature says it is enabled but it does not show up in the Admin interface. I don't believe the Migrations ran; that is where I create a new database table and make the Content Part attachable. I also wire up the type with a TitlePart and Common Part, make it Creatable and Draftable. The table does not get created in the database.

I'm on Orchard 1.7.2. I'm deploying to Azure Websites running multiple instances. I'm using a shared Azure SQL Database. I enabled the Azure Cache and Azure Blob Storage. I ensured the website was working in this environment successfully before deploying my module. I deployed my module both from Web Publishing and also as a nuget package with the same effects. I'm using Visual Studio 2012. The Error log file in App_Data/Logs is empty and no errors have ever been recorded that might offer some clues.

I am unable to use remote debugging because it is a Visual Studio 2013 feature but perhaps that is what I need to do next to see if an exception is being thrown.

I'm not sure what else to check. Can anyone provide some insight into how I can more effectively troubleshoot this problem?

Dec 26, 2013 at 4:25 PM
Edited Dec 26, 2013 at 4:25 PM
You have to add your module as a reference to Orchard.Azure.Web project.
Otherwise Orchard enables your module but cannot find your binary (dll) file to execute it.
And yes your migration is not running at all.

You could also change HostComponents.config under Config folder of Orchard.Azure.Web project
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
                <!-- Set Value="true" to disable new extensions monitoring -->
                <Property Name="Disabled" Value="true"/>
which is true by default for performance issues.
Dec 26, 2013 at 6:20 PM
@grapto: OP said she is deploying to Azure Web Sites, in which case the Orchard.Azure.Web project is not involved at all.

@Kelly: Not sure about your particular problem without doing some more digging, but off the top of my head, one thing to look out for when deploying to Azure Web Sites using Visual Studio is that your module needs to be built for its DLLs to be included in the published package. For this to happen you need to either do a build of the whole solution yourself before publishing, or you can add a project dependency from Orchard.Web to your module project (not an project reference, just a dependency by right-clicking the solution and selecting "Project Dependencies" from the context menu).
Dec 26, 2013 at 6:52 PM
@Decorum correct, I always forget azure web sites, I only use cloud services.

But the problem looks similar (btw. orchard should not state the module enabled if dlls are missing, it's misleading).

Another reason I can think of is that you are running on multiple instances with a shared database. As far as I remember (not 100% sure) is that after enabling/disabling modules and changing content definitions you have to restart the unaware instances to read the new settings. At least this is what I understand from and from the discussion Decorum started here and I am not sure if Azure Cache solved this issue.