--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-12-14 11:45:28 -08:00
10 changed files with 34 additions and 63 deletions

View File

@@ -1,7 +1,10 @@
using System.Web;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Orchard.Environment;
namespace Orchard.Azure.Web {
@@ -16,6 +19,21 @@ namespace Orchard.Azure.Web {
}
protected void Application_Start() {
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSetter) =>
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
);
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
RoleEnvironment.Changing += (sender, e) => {
// If a configuration setting is changing
if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange)) {
// Set e.Cancel to true to restart this role instance
e.Cancel = true;
}
};
RegisterRoutes(RouteTable.Routes);
_host = OrchardStarter.CreateHost(MvcSingletons);

View File

@@ -58,7 +58,7 @@
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="NHibernate.ByteCode.Castle">
<HintPath>..\..\..\lib\fluentnhibernate\NHibernate.ByteCode.Castle.dll</HintPath>
</Reference>
@@ -144,7 +144,6 @@
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebRole.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />

View File

@@ -1,28 +0,0 @@
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
namespace Orchard.Azure.Web {
public class WebRole : RoleEntryPoint {
public override bool OnStart() {
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSetter) =>
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
);
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
RoleEnvironment.Changing += RoleEnvironmentChanging;
return base.OnStart();
}
private static void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e) {
// If a configuration setting is changing
if ( e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange) ) {
// Set e.Cancel to true to restart this role instance
e.Cancel = true;
}
}
}
}