Beispiel #1
0
        public static ActionResult RegisterApplication(Session session)
        {
            session.Log("Begin configure web application");

            try
            {
                // parameters
                var    appId = new Guid(session["APP_ID"]);
                ushort port  = ushort.Parse(session["APP_PORT"]);
                string path  = session["APP_PATH"];

                // init
                WebAppConfigEntry app = Metabase.GetWebAppEntry(appId);
                app.ApplicationName   = "NooLite Web Control Panel";
                app.VirtualDirectory  = string.Empty;
                app.PhysicalDirectory = path;

                app.ListenAddresses.Clear();
                app.ListenAddresses.AddAddresses(new ListenAddress(port));

                app.AppType = ApplicationType.AspNetOrStaticHtml;
                app.Stopped = false;

                // register webapp
                Metabase.RegisterApplication(RuntimeVersion.AspNet_4, false, app, new AppShortcut[0]);
            }
            catch (Exception ex)
            {
                session.Log("ERROR in configure web application: {0}", ex.ToString());
                return(ActionResult.Failure);
            }

            session.Log("End configure web application");
            return(ActionResult.Success);
        }