예제 #1
0
        private void ProcessDeaStart(string message, string reply)
        {
            if (shutting_down)
            {
                return;
            }

            log.Debug(Resources.Agent_ProcessDeaStart_Fmt, message);

            Droplet droplet = Message.FromJson <Droplet>(message);

            if (false == droplet.FrameworkSupported)
            {
                log.Info(Resources.Agent_NonAspDotNet_Message);
                return;
            }

            var instance = new Instance(config.AppDir, droplet);

            if (filesManager.Stage(droplet, instance))
            {
                WebServerAdministrationBinding binding = webServerProvider.InstallWebApp(
                    filesManager.GetApplicationPathFor(instance), instance.Staged, instance.ManagedRuntimeVersion);
                if (null == binding)
                {
                    log.Error(Resources.Agent_ProcessDeaStartNoBindingAvailable, instance.Staged);
                    filesManager.CleanupInstanceDirectory(instance, true);
                }
                else
                {
                    instance.Host = binding.Host;
                    instance.Port = binding.Port;

                    configManager.BindServices(droplet, instance);
                    configManager.SetupEnvironment(droplet, instance);

                    instance.OnDeaStart();

                    if (false == shutting_down)
                    {
                        SendSingleHeartbeat(new Heartbeat(instance));

                        RegisterWithRouter(instance, instance.Uris);

                        dropletManager.Add(droplet.ID, instance);

                        TakeSnapshot();

                        reservedMemoryMB += instance.MemQuotaMB;
                    }
                }
            }
        }