mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#20433: Added specialized implementation of IMachineNameProvider that uses the role instance ID instead of the Windows machine name for task lease records, and activated this implementation for cloud services through Host.config. This makes task lease records resilient to role instance reimaging.
Work Item: 20433
This commit is contained in:
@@ -7,9 +7,14 @@
|
||||
|
||||
<autofac defaultAssembly="Orchard.Framework">
|
||||
<components>
|
||||
|
||||
<!-- Configure Orchard to store shell settings in Windows Azure Blob Storage. -->
|
||||
<component instance-scope="single-instance" type="Orchard.FileSystems.Media.ConfigurationMimeTypeProvider, Orchard.Framework" service="Orchard.FileSystems.Media.IMimeTypeProvider"></component>
|
||||
<component instance-scope="single-instance" type="Orchard.Azure.Services.Environment.Configuration.AzureBlobShellSettingsManager, Orchard.Azure" service="Orchard.Environment.Configuration.IShellSettingsManager"></component>
|
||||
|
||||
<!-- Configure Orchard to use role instance ID instead of Windows machine name for task lease records. -->
|
||||
<component instance-scope="single-instance" type="Orchard.Azure.Services.TaskLease.AzureMachineNameProvider, Orchard.Azure" service="Orchard.TaskLease.Services.IMachineNameProvider, Orchard.TaskLease"></component>
|
||||
|
||||
</components>
|
||||
</autofac>
|
||||
|
||||
|
@@ -69,6 +69,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.Diagnostics.StorageUtility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.ServiceRuntime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.Storage.dll</HintPath>
|
||||
@@ -84,6 +88,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Services\TaskLease\AzureMachineNameProvider.cs" />
|
||||
<Content Include="Web.config" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Content Include="Module.txt" />
|
||||
@@ -97,6 +102,10 @@
|
||||
<Project>{6e444ff1-a47c-4cf6-bb3f-507c8ebd776d}</Project>
|
||||
<Name>Orchard.OutputCache</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.TaskLease\Orchard.TaskLease.csproj">
|
||||
<Project>{3f72a4e9-7b72-4260-b010-c16ec54f9baf}</Project>
|
||||
<Name>Orchard.TaskLease</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
|
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.WindowsAzure.ServiceRuntime;
|
||||
using Orchard.TaskLease.Services;
|
||||
|
||||
namespace Orchard.Azure.Services.TaskLease
|
||||
{
|
||||
public class AzureMachineNameProvider : IMachineNameProvider
|
||||
{
|
||||
public string GetMachineName()
|
||||
{
|
||||
return RoleEnvironment.CurrentRoleInstance.Id;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user