title: How to set React port for development environment with ASP.Net Core 3.0?
body: <p>I have an ASP.net Core + React application which is created by using template in Visual Studio.</p>
  
  <p>I'm trying to serve react application on a constant port for Windows environment to set cors settings but I couldn't achieved it.</p>
  
  <p>I have tried the approaches listed below, but the result didn't change.</p>
  
  <ul>
  <li>I have created .env file which contains a line like that. 'PORT:5000'</li>
  <li>I changed the npm command to "start": "set PORT=5000 &amp;&amp; react-scripts start "</li>
  </ul>
  
  <p>I have configured the application like that.</p>
  
  <pre><code>app.UseSpa(spa =&gt;
  {
      spa.Options.SourcePath = "ClientApp";
      spa.Options.StartupTimeout = TimeSpan.FromSeconds(120);
      if (env.IsDevelopment())
      {
           spa.UseReactDevelopmentServer(npmScript: "start");
       }
   });
  </code></pre>
  
  <p>By the way, for the future versions of Asp.net core they have added DevServerPort parameter in SpaOptions within <a href="https://github.com/aspnet/AspNetCore/commit/968e85a3977d3634602891eecd90e456131ae0c3#diff-3de9fe3304f55fc57db25df3ed1dc00c" rel="nofollow noreferrer">commit</a> but for now I couldn't get it working. </p>