Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created August 9, 2018 01:49
Show Gist options
  • Save dcomartin/b4eeb77defa0c5e3d2e63c8c5378defc to your computer and use it in GitHub Desktop.
Save dcomartin/b4eeb77defa0c5e3d2e63c8c5378defc to your computer and use it in GitHub Desktop.
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace Demo
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args);
}
private static IWebHost BuildWebHost(string[] args)
{
var webhost = WebHost.CreateDefaultBuilder(args)
.SniffRouteData()
.UseStartup<Startup>()
.Build();
var urlHelper = webhost.GetStaticUrlHelper("https://my.internal.service:48923/somepath");
Console.WriteLine(urlHelper.Link(nameof(ValuesController), null));
return webhost;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment