本文整理汇总了C#中System.Net.IPEndPoint.ToHttp方法的典型用法代码示例。如果您正苦于以下问题:C# IPEndPoint.ToHttp方法的具体用法?C# IPEndPoint.ToHttp怎么用?C# IPEndPoint.ToHttp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.IPEndPoint
的用法示例。
在下文中一共展示了IPEndPoint.ToHttp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServerInfo
public ServerInfo(IProcessManagerSync pm, IPEndPoint http, IPEndPoint https) {
IsHttpPortRegistered = (http != null) && QueryPortRegistered(pm, http.ToHttp());
IsHttpsPortRegistered = (https != null) && QueryPortRegistered(pm, https.ToHttps());
IsCertRegistered = QueryCertRegistered(pm, https);
MainLog.Logger.Info(
$"HttpRegistered: {IsHttpPortRegistered} ({http}), HttpsRegistered: {IsHttpsPortRegistered} ({https}), CertRegistered: {IsCertRegistered}");
}
示例2: BuildUrls
private static List<string> BuildUrls(IPEndPoint http, IPEndPoint https) {
var urls = new List<string>();
if ((http == null) && (https == null))
throw new CannotOpenApiPortException("No HTTP or HTTPS ports available");
if (http != null)
urls.Add(http.ToHttp());
if (https != null)
urls.Add(https.ToHttps());
return urls;
}
示例3: Run
public virtual Task Run(IPEndPoint http, IPEndPoint https, CancellationToken cancelToken) {
var hostBuilder = new WebHostBuilder();
// .UseContentRoot(Directory.GetCurrentDirectory())
ConfigureBuilder(hostBuilder);
var urls = new List<string>();
if ((http == null) && (https == null))
throw new CannotOpenApiPortException("No HTTP or HTTPS ports available");
if (http != null)
urls.Add(http.ToHttp());
if (https != null)
urls.Add(https.ToHttps());
hostBuilder.UseUrls(urls.ToArray());
var webHost = hostBuilder.Build();
return TaskExt.StartLongRunningTask(() => webHost.Run(cancelToken), cancelToken);
}