mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-20 04:42:20 +08:00

LF is the git default and all new files are stored as such. Old files from the hg to git conversion however were moved over as CRLF.
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using System.Web.Routing;
|
|
using Autofac;
|
|
using Microsoft.WindowsAzure.ServiceRuntime;
|
|
using Microsoft.WindowsAzure.Storage;
|
|
using Orchard.Environment;
|
|
|
|
namespace Orchard.Azure.Web {
|
|
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
|
|
// visit http://go.microsoft.com/?LinkId=9394801
|
|
|
|
public class MvcApplication : HttpApplication {
|
|
private static IOrchardHost _host;
|
|
|
|
public static void RegisterRoutes(RouteCollection routes) {
|
|
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
|
}
|
|
|
|
protected void Application_Start() {
|
|
|
|
// 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);
|
|
_host.Initialize();
|
|
}
|
|
|
|
protected void Application_BeginRequest() {
|
|
Context.Items["originalHttpContext"] = Context;
|
|
|
|
_host.BeginRequest();
|
|
}
|
|
|
|
protected void Application_EndRequest() {
|
|
_host.EndRequest();
|
|
}
|
|
|
|
static void MvcSingletons(ContainerBuilder builder) {
|
|
builder.Register(ctx => RouteTable.Routes).SingleInstance();
|
|
builder.Register(ctx => ModelBinders.Binders).SingleInstance();
|
|
builder.Register(ctx => ViewEngines.Engines).SingleInstance();
|
|
}
|
|
|
|
}
|
|
}
|