I've created a self hosted service using the Microsoft OWIN 3.0.1, and Web API 5.2.3 NuGet packages. It is also using the Microsoft.AspNet.WebApi Cors.5.2.3 and Microsoft.Owin.Cors 3.0.1 packages for CORS support. The CORS setup is configured as follows:
private static void ConfigureCrossOriginResourceSharing(IAppBuilder app, HttpConfiguration config)
{
app.UseCors(CorsOptions.AllowAll);
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
}
The hosting is started as follows:
var startOptions = new StartOptions(url: "http://*:64000/");
Task.Run(() =>
{
// Start OWIN host
using (WebApp.Start(startOptions, startUp.Configuration))
{
//etc.
When connecting to the service I can only use an IP address to call it (e.g. http://192.168.0.1:64000/). When using the DNS name (i.e. http://hostname:64000/) an HTTP 502 Bad Gateway error is returned. This isn't ideal.
I assume this has something to do with the CORS configuration. Any ideas what could be wrong?
UPDATE: At the suggestion below I've changed the start url to http://+:64000/. I am now getting a 400 Bad Request response from the client. I can ping the server which resolves to a fully qualified name ( e.g. hostname.domain.corp domain suffix) which I've also tried but get the same result.