title: .Net Core 2.2 App Returning 404 for every call on Linux AWS Instance
body: <p>I setup a .Net Core application on an AWS EC2 instance and can't seem to get my calls to succeed.
  Specifically, I find that routes that work just fine on my localhost when I run locally do not work on this Linux box. I followed some instructions from Microsoft to setup Kestrel with an nginx reverse proxy.</p>
  <p>Relevent details:</p>
  <p>I have a working route that functions on my localhost:</p>
  <pre><code>[HttpGet(&quot;test&quot;)]
  [AllowAnonymous]
  public ActionResult Test()
  {
      return Ok(&quot;WORKED&quot;);
  }
  </code></pre>
  <p>On my Linux box, I start dotnet (and have verified nginx is running). I do dotnet MyApp.dll and it says it's listening.</p>
  <p>I now make a Postman call to <a href="http://api.mydomainhere.com" rel="nofollow noreferrer">http://api.mydomainhere.com</a></p>
  <p>and in my command/terminal where I have dotnet running, I see the request come in:</p>
  <pre><code>[ec2-user@xxxxxx MyApp]$ dotnet MyApp.dll
  info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
        User profile is available. Using '/home/ec2-user/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
  Hosting environment: Production
  Content root path: /home/ec2-user/MyApp
  Now listening on: http://localhost:5000
  Now listening on: https://localhost:5001
  Application started. Press Ctrl+C to shut down.
  info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
        Request starting HTTP/1.1 GET http://api.mydomainhere.com/api/users/Test application/json 119
  info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
        Request finished in 67.8504ms 404 
  info: Microsoft.AspNetCore.Server.Kestrel[32]
        Connection id &quot;0HM0NUJ8Q68OU&quot;, Request id &quot;0HM0NUJ8Q68OU:00000001&quot;: the application completed without reading the entire request body.
  </code></pre>
  <p>My nginx setup is:</p>
  <pre><code>server {
      listen        80;
      server_name   _;
      location / {
          proxy_pass         http://localhost:5000;
          proxy_http_version 1.1;
          proxy_set_header   Upgrade $http_upgrade;
          proxy_set_header   Connection keep-alive;
          proxy_set_header   Host $host;
          proxy_cache_bypass $http_upgrade;
          proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header   X-Forwarded-Proto $scheme;
      }
  }
  </code></pre>
  <p>Despite this, when I call /api/users/test, it 404's me, and if I run the same test locally, it works. Is there a misconfiguration in my app settings in .Net or anything like that?</p>
  <p>If I try a curl command from the Linux instance I also get a 404, which means I can't even hit the .Net app right?</p>
  <p>ec2-user@xxxx ~]$ <strong>curl -v -H &quot;Content-Type: application/json&quot; http://localhost:5000/api/users/test</strong></p>
  <pre><code>*   Trying 127.0.0.1...
  * TCP_NODELAY set
  * Connected to localhost (127.0.0.1) port 5000 (#0)
  &gt; GET /api/users/test HTTP/1.1
  &gt; Host: localhost:5000
  &gt; User-Agent: curl/7.61.1
  &gt; Accept: */*
  &gt; Content-Type: application/json
  &gt; 
  &lt; HTTP/1.1 404 Not Found
  &lt; Date: Wed, 24 Jun 2020 04:22:41 GMT
  &lt; Server: Kestrel
  &lt; Content-Length: 0
  &lt; 
  * Connection #0 to host localhost left intact
  </code></pre>
  <p>Any suggestions or areas to start looking at?</p>
  <p>Thank you!</p>