예제 #1
0
        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = 64;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.UseNagleAlgorithm      = false;

            #region Launch silo in separate AppDomain

            var dataConnectionString     = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString");
            var orleansSiloConfiguration = File.ReadAllText("OrleansConfiguration.xml").Replace(
                "XXXDataConnectionStringValueXXX", dataConnectionString);
            this.siloHost = new SiloHost();
            this.siloHost.StartLobbyServiceSiloAppDomain(orleansSiloConfiguration);

            #endregion

            Trace.TraceInformation("LobbyServiceInstanceId " + this.SharedSettings.InstanceId);
            Trace.TraceInformation("Settings.IPEndPoint    " + this.LobbyServiceSettings.IPEndPoint.ToString());

            if (!OrleansAzureClient.IsInitialized)
            {
                OrleansAzureClient.Initialize("ClientConfiguration.xml");
            }

            var server = new AsyncServerHost(this.LobbyServiceSettings.IPEndPoint);
            this.lobbyServerImpl = cc.GetExportedValue <LobbyServerImpl>();
            this.lobbyTask       = server.Start(lobbyServerImpl, cts.Token);

            return(true);
        }
예제 #2
0
        static void InitializeOrleansClient()
        {
            var clientConfigFile = AzureConfigUtils.ClientConfigFileLocation;

            if (!clientConfigFile.Exists)
            {
                throw new FileNotFoundException(clientConfigFile.FullName);
            }

            OrleansAzureClient.Initialize(clientConfigFile);
        }
예제 #3
0
 public static void EnsureOrleansClientInitialized()
 {
     if (!OrleansAzureClient.IsInitialized)
     {
         FileInfo clientConfigFile = AzureConfigUtils.ClientConfigFileLocation;
         if (!clientConfigFile.Exists)
         {
             throw new FileNotFoundException(
                       string.Format("Cannot find Orleans client config file for initialization at {0}",
                                     clientConfigFile.FullName), clientConfigFile.FullName);
         }
         OrleansAzureClient.Initialize(clientConfigFile);
     }
 }
예제 #4
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Orleans Client
            if (!OrleansAzureClient.IsInitialized)
            {
                OrleansAzureClient.Initialize(Server.MapPath(@"~/ClientConfiguration.xml"));
            }

            OrleansConfig.InitializeOrleans();
        }
예제 #5
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            if (RoleEnvironment.IsAvailable)
            {
                OrleansAzureClient.Initialize(Server.MapPath("~/AzureConfiguration.xml"));
            }
            else
            {
                Orleans.OrleansClient.Initialize(Server.MapPath("~/ClientConfiguration.xml"));
            }
        }
예제 #6
0
 protected void Application_Start()
 {
     if (RoleEnvironment.IsAvailable)
     {
         // running in Azure
         OrleansAzureClient.Initialize(Server.MapPath(@"~/AzureConfiguration.xml"));
     }
     else
     {
         // not running in Azure
         OrleansClient.Initialize(Server.MapPath(@"~/LocalConfiguration.xml"));
     }
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
 }
예제 #7
0
        /// <summary>
        /// Configures Orleans for use with Azure.
        /// </summary>
        /// <remarks>This should appear earlier in the pipeline than any usage of Orleans.</remarks>
        /// <param name="app">The app being configured.</param>
        /// <param name="clientConfigurationFile">The client configuration file.</param>
        public static void ConfigureOrleans(this IAppBuilder app, FileInfo clientConfigurationFile)
        {
            app.Use(
                async(context, next) =>
            {
                if (!OrleansAzureClient.IsInitialized)
                {
                    lock (InitializationLock)
                    {
                        if (!OrleansAzureClient.IsInitialized)
                        {
                            OrleansAzureClient.Initialize(clientConfigurationFile);
                        }
                    }
                }

                await next.Invoke().ConfigureAwait(false);
            });
        }
예제 #8
0
        public ActionResult Index()
        {
            ViewBag.Title = "Adventure Terre";

            if (!OrleansAzureClient.IsInitialized)
            {
                FileInfo clientConfigFile = AzureConfigUtils.ClientConfigFileLocation;
                if (!clientConfigFile.Exists)
                {
                    var configFilePath = System.Web.Hosting.HostingEnvironment.MapPath("~/bin/") + "ClientConfiguration.xml";
                    OrleansAzureClient.Initialize(configFilePath);
                }
                else
                {
                    OrleansAzureClient.Initialize(clientConfigFile);
                }
            }

            return(View());
        }
예제 #9
0
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            if (!OrleansAzureClient.IsInitialized)
            {
                FileInfo clientConfigFile = AzureConfigUtils.ClientConfigFileLocation;
                if (!clientConfigFile.Exists)
                {
                    //throw new FileNotFoundException(string.Format("Cannot find Orleans client config file for initialization at {0}", clientConfigFile.FullName), clientConfigFile.FullName);
                    var configFilePath = System.Web.Hosting.HostingEnvironment.MapPath("~/bin/") + "ClientConfiguration.xml";
                    OrleansAzureClient.Initialize(configFilePath);
                }
                else
                {
                    OrleansAzureClient.Initialize(clientConfigFile);
                }
            }

            AreaRegistration.RegisterAllAreas();
            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }