コード例 #1
0
        public void GetVirtualRootStatus(string RootWebServer, string inBaseUrl, string inVirtualRoot, out string Exists, out string SSL, out string WindowsAuth, out string Anonymous, out string HomePage, out string DiscoFile, out string PhysicalPath, out string BaseUrl, out string VirtualRoot)
        {
            string rootWebServer = "IIS://localhost/W3SVC/1/ROOT";

            if (RootWebServer.Length > 0)
            {
                rootWebServer = RootWebServer;
            }
            Exists      = "false";
            SSL         = "false";
            WindowsAuth = "false";
            Anonymous   = "false";
            HomePage    = "false";
            DiscoFile   = "false";
            SoapServerInfo.ParseUrl(inBaseUrl, inVirtualRoot, "http", out BaseUrl, out VirtualRoot);
            PhysicalPath = SoapServerInfo.ServerPhysicalPath(rootWebServer, BaseUrl, VirtualRoot, false);
            bool bExists      = false;
            bool bSSL         = false;
            bool bWindowsAuth = false;
            bool bAnonymous   = false;
            bool bHomePage    = false;
            bool bDiscoFile   = false;

            IISVirtualRootEx.GetStatus(rootWebServer, PhysicalPath, VirtualRoot, out bExists, out bSSL, out bWindowsAuth, out bAnonymous, out bHomePage, out bDiscoFile);
            if (bExists)
            {
                Exists = "true";
            }
            if (bSSL)
            {
                SSL = "true";
                SoapServerInfo.ParseUrl(inBaseUrl, inVirtualRoot, "https", out BaseUrl, out VirtualRoot);
            }
            if (bWindowsAuth)
            {
                WindowsAuth = "true";
            }
            if (bAnonymous)
            {
                Anonymous = "true";
            }
            if (bHomePage)
            {
                HomePage = "true";
            }
            if (bDiscoFile)
            {
                DiscoFile = "true";
            }
        }
コード例 #2
0
        public void CreateVirtualRootEx(string rootWebServer, string inBaseUrl, string inVirtualRoot, string homePage, string discoFile, string secureSockets, string authentication, string operation, out string baseUrl, out string virtualRoot, out string physicalPath)
        {
            baseUrl      = "";
            virtualRoot  = "";
            physicalPath = "";
            bool inDefault   = true;
            bool windowsAuth = true;
            bool anonymous   = false;
            bool flag4       = false;
            bool flag5       = false;
            bool impersonate = true;

            try
            {
                new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
                if ((inBaseUrl.Length > 0) || (inVirtualRoot.Length > 0))
                {
                    string str = "IIS://localhost/W3SVC/1/ROOT";
                    if (rootWebServer.Length > 0)
                    {
                        str = rootWebServer;
                    }
                    if (authentication.ToLower(CultureInfo.InvariantCulture) == "anonymous")
                    {
                        anonymous   = true;
                        windowsAuth = false;
                        impersonate = false;
                    }
                    flag4     = SoapServerInfo.BoolFromString(discoFile, flag4);
                    flag5     = SoapServerInfo.BoolFromString(homePage, flag5);
                    inDefault = SoapServerInfo.BoolFromString(secureSockets, inDefault);
                    string inProtocol = "https";
                    if (!inDefault)
                    {
                        inProtocol = "http";
                    }
                    SoapServerInfo.CheckUrl(inBaseUrl, inVirtualRoot, inProtocol);
                    SoapServerInfo.ParseUrl(inBaseUrl, inVirtualRoot, inProtocol, out baseUrl, out virtualRoot);
                    physicalPath = SoapServerInfo.ServerPhysicalPath(str, inBaseUrl, inVirtualRoot, true);
                    SoapServerConfig.Create(physicalPath, impersonate, windowsAuth);
                    if (flag4)
                    {
                        new DiscoFile().Create(physicalPath, "Default.disco");
                    }
                    else if (File.Exists(physicalPath + @"\Default.disco"))
                    {
                        File.Delete(physicalPath + @"\Default.disco");
                    }
                    if (flag5)
                    {
                        HomePage page     = new HomePage();
                        string   discoRef = "";
                        if (flag4)
                        {
                            discoRef = "Default.disco";
                        }
                        page.Create(physicalPath, virtualRoot, "Default.aspx", discoRef);
                    }
                    else if (File.Exists(physicalPath + @"\Default.aspx"))
                    {
                        File.Delete(physicalPath + @"\Default.aspx");
                    }
                    IISVirtualRootEx.CreateOrModify(str, physicalPath, virtualRoot, inDefault, windowsAuth, anonymous, flag5);
                }
            }
            catch (Exception exception)
            {
                if ((exception is NullReferenceException) || (exception is SEHException))
                {
                    throw;
                }
                ComSoapPublishError.Report(Resource.FormatString("Soap_VRootCreationFailed") + " " + virtualRoot);
                throw;
            }
        }
コード例 #3
0
        /// <include file='doc\SoapServerVroot.uex' path='docs/doc[@for="SoapServerVRoot.CreateVirtualRootEx"]/*' />
        public void CreateVirtualRootEx(
            string rootWebServer,
            string inBaseUrl,
            string inVirtualRoot,
            string homePage,
            string discoFile,
            string secureSockets,
            string authentication,
            string operation,
            out string baseUrl,
            out string virtualRoot,
            out string physicalPath
            )
        {
            // if Operation if an empty string, the VRoot will be published
            baseUrl      = "";
            virtualRoot  = "";
            physicalPath = "";
            bool bSSL         = true;
            bool bWindowsAuth = true;
            bool bAnonymous   = false;
            bool bDiscoFile   = false;
            bool bHomePage    = false;
            bool bImpersonate = true;

            try
            {
                SecurityPermission sp = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
                sp.Demand();
                Platform.Assert(Platform.Whistler, "SoapServerVRoot.CreateVirtualRootEx");
                if (inBaseUrl.Length <= 0 && inVirtualRoot.Length <= 0)
                {
                    return;
                }
                string rootWeb = "IIS://localhost/W3SVC/1/ROOT";
                if (rootWebServer.Length > 0)
                {
                    rootWeb = rootWebServer;
                }
                if (authentication.ToLower(CultureInfo.InvariantCulture) == "anonymous")
                {
                    bAnonymous   = true;
                    bWindowsAuth = false;
                    bImpersonate = false;
                }
                bDiscoFile = SoapServerInfo.BoolFromString(discoFile, bDiscoFile);
                bHomePage  = SoapServerInfo.BoolFromString(homePage, bHomePage);
                bSSL       = SoapServerInfo.BoolFromString(secureSockets, bSSL);
                string protocol = "https";
                if (!bSSL)
                {
                    protocol = "http";
                }
                SoapServerInfo.ParseUrl(inBaseUrl, inVirtualRoot, protocol, out baseUrl, out virtualRoot);
                physicalPath = SoapServerInfo.ServerPhysicalPath(rootWeb, inBaseUrl, inVirtualRoot, true);
                SoapServerConfig.Create(physicalPath, bImpersonate, bWindowsAuth);
                if (bDiscoFile)
                {
                    DiscoFile webDisco = new DiscoFile();
                    webDisco.Create(physicalPath, "Default.disco");
                }
                else
                {
                    if (File.Exists(physicalPath + "\\Default.disco"))
                    {
                        File.Delete(physicalPath + "\\Default.disco");
                    }
                }
                if (bHomePage)
                {
                    HomePage webPage       = new HomePage();
                    string   discoFileName = "";
                    if (bDiscoFile)
                    {
                        discoFileName = "Default.disco";
                    }
                    webPage.Create(physicalPath, virtualRoot, "Default.aspx", discoFileName);
                }
                else
                {
                    if (File.Exists(physicalPath + "\\Default.aspx"))
                    {
                        File.Delete(physicalPath + "\\Default.aspx");
                    }
                }
                IISVirtualRootEx.CreateOrModify(rootWeb, physicalPath, virtualRoot, bSSL, bWindowsAuth, bAnonymous, bHomePage);
            }
            catch
            {
                string etxt = Resource.FormatString("Soap_VRootCreationFailed");
                ComSoapPublishError.Report(etxt + " " + virtualRoot);
                throw;
            }
        }