本文整理汇总了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");
}
示例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();
}
示例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;
}