title: Visual studio docker tools publish port when debugging
body: <p>I'm just getting started with Docker and have installed docker for windows. 
  <br/>The basic setup of docker is correct and i have been able to debug a simple Asp.Net Core app which is deployed to a container from within Visual studio (using the standard 'Run' command targeting docker).</p>
  
  <p>The problem i'm having is being able to hit the endpoint hosted from within the container without using localhost i.e. using the IP of the container. I need this as i'm intending to hit the endpoint from a xamarin app.</p>
  
  <p>After doing some reading, it seems i need to 'publish' the port that the application is running, in this case port 5000, but i can't seem to find where to configure visual studio to do this.</p>
  
  <p>Using postman or a web browser to hit the endpoint results in the same response Empty_Response error.</p>
  
  <p>I'm hoping someone can point me in the right direction</p>
  
  <p>My Dockerfile:</p>
  
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
  WORKDIR /app
  EXPOSE 5000
  ENV ASPNETCORE_URLS http://&lt;container ip&gt;:5000
  
  FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
  WORKDIR /src
  COPY ["ItemCheckout/ItemCheckout.csproj", "ItemCheckout/"]
  RUN dotnet restore "ItemCheckout/ItemCheckout.csproj"
  COPY . .
  WORKDIR "/src/ItemCheckout"
  RUN dotnet build "ItemCheckout.csproj" -c Release -o /app
  
  FROM build AS publish
  RUN dotnet publish "ItemCheckout.csproj" -c Release -o /app
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app .
  ENTRYPOINT ["dotnet", "ItemCheckout.dll"]
  </code></pre>
  
  <p>Startup.cs:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Startup
  {
      private static readonly LoggerFactory _loggerFactory = new LoggerFactory(new []{new DebugLoggerProvider()});
  
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc();
          services.AddDbContext&lt;ItemCheckoutDbContext&gt;(o =&gt;
              {
                  o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
                  o.UseLoggerFactory(_loggerFactory);
              });
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseMvc();
      }
  }
  </code></pre>
  
  <p>program.cs:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Program
  {
      public static async Task Main(string[] args)
      {
          await CreateWebHostBuilder(args).Build().RunAsync();
      }
  
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;
          WebHost.CreateDefaultBuilder(args)
              .UseKestrel()
              .UseUrls("http://&lt;container ip&gt;:5000")
              .UseStartup&lt;Startup&gt;();
  }
  </code></pre>
  
  <p>Output when running:</p>
  
  <p>Hosting environment: Development
  <br/>Content root path: /app
  <br/>Now listening on: http://<code>&lt;container ip&gt;</code>:5000
  <br/>Application started. Press Ctrl+C to shut down.</p>
  
  <p><strong>EDIT:</strong> Updated program.cs as per @MindSwipe's suggestion, however i am still getting the same result</p>