I\'m attempting to create a Web API via .Net Core. I\'m just using the boilerplate ValuesController as a Hello World. When I run the project, I get the following error:
I was able to at least temporarily solve this issue by implementing a workaround provided by Bill Boga on his site here: https://www.billbogaiv.com/posts/setting-aspnet-host-address-in-net-core-2
The key for my project was to add .UseUrls(urls: "http://localhost:10000") in the BuildWebHost function. Like so:
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using OrchardCore.Logging;
using OrchardCore.Modules;
namespace ShiftBrandSite
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseNLogWeb()
.UseStartup()
.UseUrls(urls: "http://localhost:10000") // <-- localhost urls
.Build();
}
}
Hope this helps!