当前位置: 首页>>代码示例>>C#>>正文


C# HttpServer.Start方法代码示例

本文整理汇总了C#中HttpServer.HttpServer.Start方法的典型用法代码示例。如果您正苦于以下问题:C# HttpServer.Start方法的具体用法?C# HttpServer.Start怎么用?C# HttpServer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpServer.HttpServer的用法示例。


在下文中一共展示了HttpServer.Start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObjectForScripting

 public ObjectForScripting()
 {
     httpServer = new HttpServer.HttpServer();
     ajaxObjectForScripting = new AjaxObjectForScripting(this);
     httpServer.Add(ajaxObjectForScripting);
     httpServer.Start(IPAddress.Any, 50505);
     httpServer.BackLog = 5;
 }
开发者ID:cpbuck12,项目名称:Db,代码行数:8,代码来源:ObjectForScripting.cs

示例2: Main

 private static void Main(string[] args)
 {
     var config = new DefaultHttpServerConfiguration() { Port = 8080, Handler = new DefaultHtmlRequestHandler("U:/CustomServer", new[] { "index.html", "default.html" }) };
     var server = new HttpServer(config);
     server.ConnectionEstablished += Server_ConnectionEstablished;
     server.ConnectionLost += Server_ConnectionLost;
     server.MessageSent += server_MessageSent;
     server.MessageReceived += server_MessageReceived;
     server.Start();
     Thread.Sleep(new TimeSpan(0,5,0));
     server.Stop();
 }
开发者ID:xsteviex,项目名称:HttpServer,代码行数:12,代码来源:Program.cs

示例3: Main

 static void Main(string[] args)
 {
     if (!EasyServer.InitConfig("Configs/Database.xml", "Database")) return;
     Databases.InitDB();
     Databases.Load();
     HttpServer.MapHandlers();
     HttpServer server = new HttpServer();
     server.Start();
     Timer aTimer = new Timer(10000);
     aTimer.Elapsed += OnTimedEvent;
     aTimer.AutoReset = true;
     aTimer.Enabled = true;
     Console.ReadLine();
 }
开发者ID:fiki574,项目名称:rAPB,代码行数:14,代码来源:Program.cs

示例4: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            client = new WebClient();
            client.Encoding = Encoding.UTF8;

            var info = new OBBInfo();
            info.ip = IPAddress.Loopback.ToString();
            info.notifyPort = Settings.Default.notifyPort;
            info.servicePort = Settings.Default.servicePort;
            info.serviceRoot = Settings.Default.serviceRoot;
             
            if (String.IsNullOrWhiteSpace(info.serviceRoot))
                info.serviceRoot = Environment.CurrentDirectory;

            OBBContext.Current.Info = info;
            OBBContext.Current.Mode = Settings.Default.mode;

            server = new HttpServer.HttpServer();
            var fileModule = new FileModule("/", OBBContext.Current.Info.serviceRoot);
            var myModule = new MyModule();
            fileModule.AddDefaultMimeTypes();
            server.Add(myModule);
            server.Add(fileModule);
            server.Start(IPAddress.Any, OBBContext.Current.Info.servicePort);

            if (OBBContext.Current.IsMaster)
            {
                OBBContext.Current.MasterInfo = OBBContext.Current.Info;

                notifyIcon1.Icon = Resources.master;
                var port = IPAddress.HostToNetworkOrder(OBBContext.Current.Info.servicePort);
                byte[] portData = BitConverter.GetBytes(port);
                notify = new UdpNotify(OBBContext.Current.Info.notifyPort, portData);
            }
            else
            {
                OBBContext.Current.LoadGameConfig();

                notifyIcon1.Icon = Resources.slave;
                notify = new UdpNotify(OBBContext.Current.Info.notifyPort);
                notify.OnData += Notify_OnData;
            }

            this.Text = OBBContext.Current.Mode.ToString();
            notifyIcon1.Text = OBBContext.Current.Mode.ToString();
            refreshTimer.Start();
            button1.Enabled = OBBContext.Current.IsMaster;
        }
开发者ID:john-guo,项目名称:hodgepodge,代码行数:48,代码来源:Form1.cs

示例5: StartTutorial

        public void StartTutorial()
        {
            _server = new HttpServer.HttpServer();

            // Let's use Digest authentication which is superior to basic auth since it
            // never sends password in clear text.
            DigestAuthentication auth = new DigestAuthentication(OnAuthenticate, OnAuthenticationRequired);
            _server.AuthenticationModules.Add(auth);

			// simple example of an regexp redirect rule. Go to http://localhost:8081/profile/arne to get redirected.
			_server.Add(new RegexRedirectRule("/profile/(?<first>[a-zA-Z0-9]+)", "/user/view/${first}"));

            // Let's reuse our module from previous tutorial to handle pages.
            _server.Add(new Tutorial3.MyModule());

            // and start the server.
            _server.Start(IPAddress.Any, 8081);

            Console.WriteLine("Goto http://localhost:8081/membersonly to get authenticated.");
            Console.WriteLine("Password is 'morsOlle', and userName is 'arne'");
        }
开发者ID:oblivious,项目名称:Oblivious,代码行数:21,代码来源:Tutorial4.cs

示例6: Initialize

        public void Initialize()
        {
            if (_server == null)
            {
                _port = getFreePort();

                _server = new HttpServer(new MyLogWriter());

                _server.Add(new MyModule(this));
                _server.Start(IPAddress.Loopback, _port);

                Trace.WriteLine(
                    string.Format(
                        @"[Web server] Started local web server for URL '{0}'.",
                        baseUrl));
            }
        }
开发者ID:ultimategrandson,项目名称:ZetaHtmlEditControl,代码行数:17,代码来源:WebServer.cs

示例7: StartListening

        public void StartListening(IGablarskiServerContext context)
        {
            var sstore = new MemorySessionStore { ExpireTime = 15 };
            server = new HttpServer.HttpServer (sstore);

            ConnectionManager cmanager = new ConnectionManager (sstore);
            cmanager.ConnectionProvider = this;
            cmanager.Server = server;

            server.Add (new QueryModule (cmanager));

            WebServerConfiguration config = (WebServerConfiguration) ConfigurationManager.GetSection ("webserver");

            if (config != null && config.Theme != null)
            {
                server.Add (new FileResourceModule (config.Theme.Path));
                server.Add (new LoginModule (cmanager));
                server.Add (new ChannelModule (cmanager));
                server.Add (new UserModule (cmanager));
            }

            server.Start (IPAddress.Any, this.Port);
        }
开发者ID:ermau,项目名称:Gablarski,代码行数:23,代码来源:WebServerConnectionProvider.cs

示例8: start_server

        private static void start_server()
        {
            try
            {
                if (Settings.EnableFileStats)
                {
                    FileSystemStats.Init();
                }

                HttpServer.HttpServer server = new HttpServer.HttpServer();

                server.ServerName = "ChanArchiver " + Version;

                server.AuthenticationModules.Add(
                    new BasicAuthentication(new AuthenticationHandler(authenticate),
                        new AuthenticationRequiredHandler(check_authenticate)));

                // Let the OOP abuse begin

                // Page handlers
                server.Add(new OverviewPageHandler());
                server.Add(new FileQueuePageHandler());
                server.Add(new WatchJobsPageHandler());
                server.Add(new MonitoredBoardsPageHandler());
                server.Add(new ThreadFiltersPageHandler());

                server.Add(new ChanArchiver.HttpServerHandlers.LogPageHandler());

                server.Add(new ChanArchiver.HttpServerHandlers.FileInfoPageHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.ResourcesHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.FileHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.BannedFilesPageHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.SettingsPageHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.ThreadJobInfoPageHandler());
                server.Add(new ChanArchiver.HttpServerHandlers.FileBrowserPageHandler());
                server.Add(new ThreadServerModule());

                // Threads actions
                server.Add(new StopAllManuallyAddedThreadsHandler());
                server.Add(new ThreadNotesHandler());
                server.Add(new DownloadAsZipHandler());

                // Settings actions
                server.Add(new ThumbnailOnlySettingsController());

                // JSON Api
                server.Add(new GetThreadsStatisticsJsonApiHandler());
                server.Add(new GetDailyNetworkStatisticsJsonApiHandler());
                server.Add(new GetMonthlyNetworkStatisticsJsonApiHandler());
                server.Add(new GetFileInfoJsonApiHandler());

                server.ExceptionThrown += server_ExceptionThrown;

                Console.WriteLine("Starting HTTP server...");
                server.Start(IPAddress.Any, port);
                Console.WriteLine("Website is accessible at (http://*:{0})", port);
            }
            catch (Exception ex)
            {
                Console.Beep();
                Console.WriteLine("Could not start HTTP server: {0}.", ex.Message);
            }
        }
开发者ID:tyzmodo,项目名称:chan-archiver,代码行数:63,代码来源:Program.cs

示例9: Run

 public void Run(int port)
 {
     var httpServer = new HttpServer.HttpServer {LogWriter = new ConsoleLogWriter()};
     httpServer.Add(this);
     httpServer.Start(IPAddress.Any, port);
 }
开发者ID:gudmundurh,项目名称:Frank,代码行数:6,代码来源:FrankApp.cs

示例10: Start

		internal void Start()
		{
			core = GetCore();
			core.Start(IPAddress.Any, 8081);
		}
开发者ID:Lyror,项目名称:EmployeeManagement,代码行数:5,代码来源:WebServer.cs


注:本文中的HttpServer.HttpServer.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。