You can run scripts so that IIS Express allows remote connections, and another option is to use the self-service wrapper for your api web code for local testing. We had the same problem, and we started using this method. Here's how you do it:
Create a new console project and add the following code:
private static void Main() { var config = new HttpSelfHostConfiguration(new Uri("http://localhost:8086")); // remove all formatters and only provide json config.Formatters.Clear(); config.Formatters.Add(new JsonMediaTypeFormatter()); // if needed SetupLogging(); SetupDependencyInjection(config); // required for the new Attribute Routing (if you are using it) config.MapHttpAttributeRoutes(); using (var server = new HttpSelfHostServer(config)) { server.OpenAsync().Wait(); Console.WriteLine("Self Host Server listening on port 8086 ..."); Console.WriteLine("(You might need administrator privileges)"); Console.WriteLine("Press Enter to quit."); Console.ReadLine(); } }
As already noted, run Visual Studio as an administrator.
We use AutoFac for dependency injection, which is pretty well connected with this, see the manual here .
Now run the console project (as a launch project, or right-click> debug> start a new instance).
source share