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


C# IHttpServer.Start方法代码示例

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


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

示例1: PortableInstallFixture

        public PortableInstallFixture()
        {
            RestoreIndex();
            Environment.SetEnvironmentVariable("WINSTON_DEBUG", "1");
            server = HttpMockRepository.At(Prefix);
            StubRepo();
            server.Start();

            var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetAbsolutePath());
            Installer = new Winstall(path);
            var res = Installer.Bootstrap(TimeSpan.FromSeconds(60));
            res.Should().Be(0);
            InstallDirectory = Path.Combine(Installer.WinstonHome.Path, "repo", "winston", "latest");
            Directory.Exists(InstallDirectory).Should().BeTrue("Installed directory should exist");
        }
开发者ID:mattolenik,项目名称:winston,代码行数:15,代码来源:PortableInstallFixture.cs

示例2: HttpPackageFixture

 public HttpPackageFixture()
 {
     server = HttpMockRepository.At(new Uri(Prefix));
     var path = Path.Combine(Assembly.GetExecutingAssembly().Directory(), "testdata", "test-0.5.zip");
     server.Stub(x => x.Get("/realpkg")).AddHeader("Content-Disposition", "attachment; filename=test-0.5.zip").ReturnFile(path).OK();
     server.Stub(x => x.Get("/realpkgnotype")).ReturnFile(path).OK();
     server.Stub(x => x.Get("/test-0.5.zip")).ReturnFile(path).OK();
     server.Stub(x => x.Head("/realpkg")).Return("").OK();
     server.Stub(x => x.Get("/redirectedpkg"))
         .Return("")
         .AddHeader("Location", $"{Prefix}/realpkg")
         .WithStatus(HttpStatusCode.Moved);
     server.Stub(x => x.Head("/redirectedpkg"))
         .Return("")
         .AddHeader("Location", $"{Prefix}/realpkg")
         .WithStatus(HttpStatusCode.Moved);
     server.Start();
 }
开发者ID:mattolenik,项目名称:winston,代码行数:18,代码来源:HttpPackageFixture.cs

示例3: Start

        public bool Start()
        {
            try
            {
                IPAddress address = IPAddress.Any;
                server = Factory.Create(address, portNumber, prefix, true, logger);

                if (server != null)
                {
                    baseURI = server.Address.AbsoluteUri;
                    server.Start(HandleConnection);
                    return true;
                }
            }
            catch (Exception e)
            {
                logger.Log("Failed to start server for " + prefix + " at port " + portNumber + ": " + e.ToString());
            }

            return false;
        }
开发者ID:knowledgehacker,项目名称:Dryad,代码行数:21,代码来源:HttpServer.cs


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