Created
August 9, 2018 01:49
-
-
Save dcomartin/b4eeb77defa0c5e3d2e63c8c5378defc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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