I've got a small problem regarding a server hosted with OWIN. I'm trying to make it accessible to the local network which means I have to add a few extra options:
// Start OWIN host
StartOptions options = new StartOptions();
options.Urls.Add("http://localhost:4004");
//options.Urls.Add("http://127.0.0.1:4004");
//options.Urls.Add(string.Format("http://{0}:4004", Environment.MachineName));
using (WebApp.Start<Startup>(options))
{
// Create HttpCient and make a request to api/values
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/text"));
}
Now the problem is, if I uncomment the second line:
options.Urls.Add("http://127.0.0.1:4004");
I'll get an error:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation.
Can someone help me out? It's weird that I can only use localhost, and not my ip.