Ejemplo n.º 1
0
        public string Deploy(HostType hostType)
        {
            Trace.WriteLine(string.Format("Deploying application in hostType = {0}", hostType));

            switch (hostType)
            {
            case HostType.IIS:
                var webDeployer = new WebDeployer();
                var webConfig   = new KatanaWebConfiguration()
                {
                    AutomaticAppStartup = AutomaticAppStartupInWebHost
                };
                ApplicationUrl   = webDeployer.Deploy(System.Guid.NewGuid().ToString(), webConfig);
                this.Application = webDeployer;
                Thread.CurrentThread.Join(SLEEP_AFTER_WEB_DEPLOY);
                break;

            case HostType.HttpListener:
                ApplicationUrl   = DefaultSelfHostUrl_Http;
                this.Application = WebApp.Start(new StartOptions(DefaultSelfHostUrl_Http));
                break;

            default:
                throw new Exception("Unknown host type");
            }

            Trace.WriteLine(string.Format("Application successfully deployed to URL : {0}", ApplicationUrl));
            return(ApplicationUrl);
        }
Ejemplo n.º 2
0
        public string Deploy(HostType hostType, Action <IAppBuilder> applicationStartup)
        {
            string startupMethodName = applicationStartup.GetFullyQualifiedConfigurationMethodName();

            Trace.WriteLine(string.Format("Deploying {0} application in hostType = {1}", startupMethodName, hostType));

            switch (hostType)
            {
            case HostType.IIS:
                var webDeployer = new WebDeployer();
                var webConfig   = new KatanaWebConfiguration()
                {
                    StartupMethod = startupMethodName, AutomaticAppStartup = AutomaticAppStartupInWebHost
                };
                ApplicationUrl   = webDeployer.Deploy(applicationStartup.GetApplicationName(), webConfig) + "/";
                this.Application = webDeployer;
                Thread.CurrentThread.Join(SLEEP_AFTER_WEB_DEPLOY);
                break;

            case HostType.HttpListener:
                ApplicationUrl   = DefaultSelfHostUrl_Http;
                this.Application = WebApp.Start(DefaultSelfHostUrl_Http, applicationStartup);
                break;

            default:
                throw new Exception("Unknown host type");
            }

            Trace.WriteLine(string.Format("Application successfully deployed to URL : {0}", ApplicationUrl));
            return(ApplicationUrl);
        }
Ejemplo n.º 3
0
        public string Deploy <T>(HostType hostType)
        {
            Trace.WriteLine(string.Format("Deploying {0} application in hostType = {1}", typeof(T).Name, hostType));

            switch (hostType)
            {
            case HostType.IIS:
                var webDeployer = new WebDeployer();
                var webConfig   = new KatanaWebConfiguration()
                {
                    StartupClass = typeof(T), AutomaticAppStartup = AutomaticAppStartupInWebHost
                };
                ApplicationUrl   = webDeployer.Deploy(typeof(T).Name, webConfig);
                this.Application = webDeployer;
                Thread.CurrentThread.Join(SLEEP_AFTER_WEB_DEPLOY);
                break;

            case HostType.HttpListener:
                ApplicationUrl   = DefaultSelfHostUrl_Http;
                this.Application = WebApp.Start <T>(DefaultSelfHostUrl_Http);
                break;

            default:
                throw new Exception("Unknown host type");
            }

            Trace.WriteLine(string.Format("Application successfully deployed to URL : {0}", ApplicationUrl));
            return(ApplicationUrl);
        }
Ejemplo n.º 4
0
 public string Deploy(string applicationName, KatanaWebConfiguration webConfig)
 {
     this.WebServer = WebServer.Create(GetWebServerType());
     string uniqueAppName = this.WebServer.DefaultWebSite.GetUniqueApplicaionName(applicationName);
     string appPhysicalPath = Path.Combine(this.WebServer.RootPhysicalPath, uniqueAppName);
     this.Application = this.WebServer.DefaultWebSite.Applications.Add("/" + uniqueAppName, appPhysicalPath);
     this.Application.Deploy(GetAssembliesInCurrentDirectory(), "bin");
     this.Application.Deploy("web.config", webConfig.GetWebConfigurationContent());
     this.WebServer.ServerManager.CommitChanges();
     return this.WebServer.DefaultWebSite.GetHttpVirtualPath() + this.Application.Path;
 }
Ejemplo n.º 5
0
        public string Deploy(string applicationName, KatanaWebConfiguration webConfig)
        {
            this.WebServer = WebServer.Create(GetWebServerType());
            string uniqueAppName   = this.WebServer.DefaultWebSite.GetUniqueApplicaionName(applicationName);
            string appPhysicalPath = Path.Combine(this.WebServer.RootPhysicalPath, uniqueAppName);

            this.Application = this.WebServer.DefaultWebSite.Applications.Add("/" + uniqueAppName, appPhysicalPath);
            this.Application.Deploy(GetAssembliesInCurrentDirectory(), "bin");
            this.Application.Deploy("web.config", webConfig.GetWebConfigurationContent());
            this.WebServer.ServerManager.CommitChanges();
            return(this.WebServer.DefaultWebSite.GetHttpVirtualPath() + this.Application.Path);
        }