Example #1
0
 public static void InitServer(TestContext context)
 {
     server = new RServer(new RServerOptions()
                          .WithHost(Host));
     server.AddRouter()
     .AddRoutes <TestRoutes>();
     server.Start();
 }
Example #2
0
        /// <summary>
        /// 启动服务
        /// </summary>
        public void Start()
        {
            if (!_started)
            {
                _started = true;

                _RServer.Start(_port);
            }
        }
Example #3
0
        /// <summary>
        /// 启动服务
        /// </summary>
        public void Start()
        {
            if (!_started)
            {
                _RServer.Start();

                RPCMapping.Regists(_serviceTypes);

                _started = true;
            }
        }
Example #4
0
        public static void Main(string[] args)
        {
            List <string> hosts = File.Exists(HostsFile) ? File.ReadAllLines(HostsFile).ToList() : new List <string>();

            var server = new RServer(new RServerOptions().WithHosts(hosts));

            server.AddLocalFiles()
            .WithFileProvider(new LocalFileProvider("www"))
            .WithMimeService(new FileMimeService("mime.map"));

            server.Start();

            while (Console.ReadLine() != ".exit")
            {
                ;
            }
        }
Example #5
0
        public static void InitServer(TestContext context)
        {
            server = new RServer(new RServerOptions()
                                 .WithHost(Host)
                                 .WithHost(HostHttps));
            server.AddLocalFiles()
            .WithFileProvider(new LocalFileProvider("www"))
            .WithMimeService(new DictionaryMimeService()
            {
                { ".txt", "text/plain" },
                { ".html", "text/html" },
                { ".pdf", "application/pdf" }
            });
            server.Start();

            client             = new HttpClient();
            client.BaseAddress = new Uri(Host);

            wc = new WebClient();
        }