title: Web api app got Http error 404.0 after published?
body: <p>I create a simple Asp.net web api app. It works when running in Visual studio. The url is <a href="http://localhost:63082/api/products/1507" rel="nofollow">http://localhost:63082/api/products/1507</a> when debugging in Visual studio 2013.</p>
  
  <p>I created an IIS website (mySite with port 8081) on a server and publish it using file sharing. However, I always get 404 error when trying the following url on the server.</p>
  
  <p><a href="http://localhost:8081/api/products/1507" rel="nofollow">http://localhost:8081/api/products/1507</a>
  (it shows the physical path is c:\inetpub\wwwroot\mySite\api\products\1507 in the error page).</p>
  
  <p><a href="http://localhost:8081/mySite/api/products/1507" rel="nofollow">http://localhost:8081/mySite/api/products/1507</a>
  (it shows the physical path is c:\inetpub\wwwroot\mySite\mySite\api\products\1507).</p>
  
  <p>Why the url is not working?</p>
  
  <p>The controller method.</p>
  
  <pre><code>    [Route("api/Products/{fileId}")]
      public IEnumerable&lt;Product&gt; GetProductsByFileId(int fileId)
      {
          using (var db = new ProductContext())
          {
              var query = from b in db.Products where b.fileId == fileId select b;
              if (query == null)
              {
                  return null;
              }
              return query.ToList();
          }
      }
  </code></pre>
  
  <p>The following shows all the published files. It seems there is no binary for the app? Is it a problem of Visual studio publishing?</p>
  
  <pre>
      Directory: \\......\c$\inetpub\wwwroot\mySite
  
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  d----          7/6/2015   6:21 PM            bin
  -a---          7/6/2015  11:23 AM        101 Global.asax
  -a---          7/6/2015   4:50 PM        574 packages.config
  -a---          7/6/2015   5:41 PM       4611 Web.config
  
  
      Directory: \\......\c$\inetpub\wwwroot\mySite\bin
  
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  -a---          7/6/2015   3:11 PM    5185232 EntityFramework.dll
  -a---          7/6/2015   3:11 PM     599760 EntityFramework.SqlServer.dll
  -a---          7/6/2015  11:21 AM     502272 Newtonsoft.Json.dll
  -a---          7/6/2015  11:21 AM     185032 System.Net.Http.Formatting.dll
  -a---          7/6/2015  11:21 AM     471240 System.Web.Http.dll
  -a---          7/6/2015  11:21 AM      82120 System.Web.Http.WebHost.dll
  -a---          7/6/2015   5:41 PM     109056 webapi.dll
  </pre>