public static WasEndpointConfigContainer Get(string webServer, string webDirectory, string applicationIdOrName)
        {
            string          webDirectoryPath = null;
            RuntimeVersions runtimeVersion   = RuntimeVersions.V40;

            if (!string.IsNullOrEmpty(applicationIdOrName))
            {
                ComAdminAppInfo appInfo = ComAdminWrapper.GetAppInfo(applicationIdOrName);
                runtimeVersion = appInfo.RuntimeVersion;
            }
            if (WasAdminWrapper.GetWebDirectoryPath(webServer, webDirectory, out webDirectoryPath))
            {
                try
                {
                    return(new WasEndpointConfigContainer(webServer, webDirectory, webDirectoryPath, runtimeVersion));
                }
                catch (Exception ex)
                {
                    if (ex is NullReferenceException || ex is SEHException)
                    {
                        throw ex;
                    }
                    ToolConsole.WriteWarning(SR.GetString(SR.FailedToLoadConfigForWebDirectoryOnWebSite, webDirectory, webServer));
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }
        public static List <WasEndpointConfigContainer> Get(string applicationIdOrName)
        {
            List <WasEndpointConfigContainer> containers = new List <WasEndpointConfigContainer>();

            string[] webServers = WasAdminWrapper.GetWebServerNames();
            if (webServers != null)
            {
                foreach (string webServer in webServers)
                {
                    List <WasEndpointConfigContainer> cont = Get(webServer, applicationIdOrName);
                    containers.AddRange(cont);
                }
            }
            return(containers);
        }
        public static List <WasEndpointConfigContainer> Get(string webServer, string applicationIdOrName)
        {
            List <WasEndpointConfigContainer> containers = new List <WasEndpointConfigContainer>();

            string[] webDirectories = WasAdminWrapper.GetWebDirectoryNames(webServer);
            if (webDirectories != null)
            {
                foreach (string webDirectory in webDirectories)
                {
                    WasEndpointConfigContainer container = Get(webServer, webDirectory, applicationIdOrName);
                    if (container != null)
                    {
                        containers.Add(container);
                    }
                }
            }
            return(containers);
        }
Beispiel #4
0
        Options(Mode mode, ArgumentDictionary arguments)
        {
            if (arguments == null)
            {
                help = true;
                return;
            }
            this.mode = mode;
            // Application
            if (arguments.ContainsArgument(Cmd.Application))
            {
                this.application = arguments.GetArgument(Cmd.Application);
            }

            // Help
            this.help = arguments.ContainsArgument(Cmd.Help);

            // Hosting
            this.hosting = Hosting.NotSpecified;

            if (arguments.ContainsArgument(Cmd.Hosting))
            {
                string argValue = arguments.GetArgument(Cmd.Hosting);
                if (string.Equals(argValue, Enum.GetName(typeof(Hosting), Hosting.Complus), StringComparison.OrdinalIgnoreCase))
                {
                    this.hosting = Hosting.Complus;
                }
                else if (string.Equals(argValue, Enum.GetName(typeof(Hosting), Hosting.Was), StringComparison.OrdinalIgnoreCase))
                {
                    if (WasAdminWrapper.IsIISInstalled())
                    {
                        this.hosting = Hosting.Was;
                    }
                    else
                    {
                        throw Tool.CreateException(SR.GetString(SR.IISNotInstalled, argValue), null);
                    }
                }
                else
                {
                    throw Tool.CreateException(SR.GetString(SR.UnknownHostingSpecified, argValue), null);
                }
            }

            this.mex = arguments.ContainsArgument(Cmd.MetaData);

            // Interface
            this.components    = null;
            this.allComponents = false;
            if (arguments.ContainsArgument(Cmd.Contract))
            {
                IList <string> argValues = arguments.GetArguments(Cmd.Contract);
                ParseInterfaces(argValues);
            }



            // NoLogo
            this.noLogo = arguments.ContainsArgument(Cmd.NoLogo);
            if (this.noLogo && arguments.Count == 1)
            {
                this.help = true;
            }

            // Verbose
            this.verbose = arguments.ContainsArgument(Cmd.Verbose);

            // WebDirectory
            if (arguments.ContainsArgument(Cmd.WebDirectory))
            {
                this.webDirectory = arguments.GetArgument(Cmd.WebDirectory);
            }

            // WebServer
            if (arguments.ContainsArgument(Cmd.WebServer))
            {
                this.webServer = arguments.GetArgument(Cmd.WebServer);
            }

            this.showGuids = arguments.ContainsArgument(Cmd.ID);

            this.allowReferences = arguments.ContainsArgument(Cmd.AllowReferences);
        }