當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseHttpServer.SetSecureParams方法代碼示例

本文整理匯總了C#中OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SetSecureParams方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseHttpServer.SetSecureParams方法的具體用法?C# BaseHttpServer.SetSecureParams怎麽用?C# BaseHttpServer.SetSecureParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Framework.Servers.HttpServer.BaseHttpServer的用法示例。


在下文中一共展示了BaseHttpServer.SetSecureParams方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetHttpServer

        public IHttpServer GetHttpServer (uint port, bool secure, string certPath, string certPass, SslProtocols sslProtocol)
        {
            if ((port == m_Port || port == 0) && HttpServer != null)
                return HttpServer;

            BaseHttpServer server;
            if(m_Servers.TryGetValue(port, out server) && server.Secure == secure)
                return server;

            string hostName =
                m_config.Configs["Network"].GetString("HostName", "http" + (secure ? "s" : "") + "://" + Utilities.GetExternalIp());
            //Clean it up a bit
            if (hostName.StartsWith("http://") || hostName.StartsWith("https://"))
                hostName = hostName.Replace("https://", "").Replace("http://", "");
            if (hostName.EndsWith ("/"))
                hostName = hostName.Remove (hostName.Length - 1, 1);

            server = new BaseHttpServer(port, hostName, secure);

            try
            {
                if(secure)//Set these params now
                    server.SetSecureParams(certPath, certPass, sslProtocol);
                server.Start();
            }
            catch(Exception)
            {
                //Remove the server from the list
                m_Servers.Remove (port);
                //Then pass the exception upwards
                throw;
            }

            return (m_Servers[port] = server);
        }
開發者ID:savino1976,項目名稱:Aurora-Sim,代碼行數:35,代碼來源:SimulationBase.cs

示例2: StartupSpecific

        protected override void StartupSpecific()
        {
            m_storageManager = CreateStorageManager();

            m_clientStackManager = CreateClientStackManager();

            Initialize();

            // Main HTTP server first
            m_httpServer = new BaseHttpServer(m_httpServerPort, null);
            m_httpServer.HostName = m_networkServersInfo.HostName; 
            MainServer.AddHttpServer(m_httpServer);

            m_log.InfoFormat("[REGION]: Starting HTTP server on {0}:{1}", m_httpServer.HostName, m_httpServerPort);
            m_httpServer.Start();

            // If specified configure an ssl server for use as well
            // you need a Cert Request/Signed pair installed in the MY store with the CN specified
            if (m_networkServersInfo.HttpUsesSSL)
            {
                if (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)
                {
                    m_log.Error("[HTTP]: HTTP Server config failed.   HTTP Server and HTTPS server must be on different ports");
                }
                else
                {
                    /// XXX Should also support specifying an IP Address
                    BaseHttpServer secureServer = new BaseHttpServer(m_networkServersInfo.httpSSLPort, null);
                    secureServer.HostName = m_networkServersInfo.HostName;

                    if (m_networkServersInfo.HttpSSLCN != null)
                        secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCN, m_networkServersInfo.sslProtocol);
                    else
                        secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCert, m_networkServersInfo.HttpSSLPassword, m_networkServersInfo.sslProtocol);

                    MainServer.AddHttpServer(secureServer);

                    m_log.Info("[REGION]: Starting HTTPS server");
                    secureServer.Start();
                }
            }

            base.StartupSpecific();
        }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:44,代碼來源:RegionApplicationBase.cs


注:本文中的OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SetSecureParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。