title: Asp.net core deployment not working on server but works on machine
body: <p>I am trying to deploy an asp.net core app on a server. I have done the following steps.</p>
  
  <p>first thing is first, this is an Windows Server 2012 r2 environment that is a brand new virtual machine.</p>
  
  <ol>
  <li>build the VM</li>
  <li>update all ms updates</li>
  <li>add iis role</li>
  <li>insure asp.net 3.5 and 4.5 are installed on machine</li>
  <li>insure http redirection and static content is installed</li>
  <li>install .net core bundle </li>
  <li>publish self contained app from Visual Studio (project name Web)</li>
  <li>add this to a folder on server.</li>
  <li>try running from web.exe</li>
  </ol>
  
  <p>I get the console app opens says now listening on: <a href="http://localhost:5000" rel="noreferrer">http://localhost:5000</a>
  10. I go to <a href="http://localhost:5000" rel="noreferrer">http://localhost:5000</a> from chrome on this machine and get a 404 not found.</p>
  
  <p>I do steps 7 8 9 and 10 on local machine which is windows 10 i get my application.</p>
  
  <p><strong>project.json</strong></p>
  
  <pre><code>  {
        "dependencies": {
          "AutoMapper": "5.1.1",
          "EntityFramework": "6.1.3",
          "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
          "Microsoft.AspNetCore.Diagnostics": "1.0.0",
          "Microsoft.AspNetCore.Mvc": "1.0.0",
          "Microsoft.AspNetCore.Razor.Tools": {
            "version": "1.0.0-preview2-final",
            "type": "build"
          },
          "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
          "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
          "Microsoft.AspNetCore.StaticFiles": "1.0.0",
          "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
          "Microsoft.Extensions.Configuration.Json": "1.0.0",
          "Microsoft.Extensions.Logging": "1.0.0",
          "Microsoft.Extensions.Logging.Console": "1.0.0",
          "Microsoft.Extensions.Logging.Debug": "1.0.0",
          "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
          "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
        },
  
        "tools": {
          "BundlerMinifier.Core": "2.0.238",
          "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
          "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
        },
  
        "frameworks": {
          "net452": {
            "dependencies": {
              "DataAccess": {
                "target": "project"
              },
              "Models": {
                "target": "project"
              }
            }
          }
        },
  
        "buildOptions": {
          "emitEntryPoint": true,
          "preserveCompilationContext": true
        },
  
        "publishOptions": {
          "include": [
            "wwwroot",
            "Views",
            "Areas/**/Views",
            "appsettings.json",
            "web.config"
          ]
        },
        "runtimes": {
          "win10-x64": {},
          "osx.10.11-64": {} 
        },
        "scripts": {
          "prepublish": [ "bower install", "dotnet bundle" ],
          "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
        }
      }
  </code></pre>
  
  <p><strong>configure from startup.cs</strong></p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
      {
          Mapper.Initialize(config =&gt;
          {
              /*View Models*/
              config.CreateMap&lt;Permit, PermitViewModel&gt;().ReverseMap();
              config.CreateMap&lt;PermitType, PermitTypeViewModel&gt;().ReverseMap();
              config.CreateMap&lt;Property, PropertyViewModel&gt;().ReverseMap();
              config.CreateMap&lt;Region, RegionViewModel&gt;().ReverseMap();
              config.CreateMap&lt;State, StateViewModel&gt;().ReverseMap();
              config.CreateMap&lt;User, UserViewModel&gt;().ReverseMap();
  
              /*Dtos*/
              config.CreateMap&lt;Permit, PermitDto&gt;().ReverseMap();
              config.CreateMap&lt;Property, PropertyDto&gt;().ReverseMap();
              config.CreateMap&lt;Region, RegionDto&gt;().ReverseMap();
              config.CreateMap&lt;State, StateDto&gt;().ReverseMap();
              config.CreateMap&lt;User, UserDto&gt;().ReverseMap();
          });
  
          loggerFactory.AddConsole(Configuration.GetSection("Logging"));
          loggerFactory.AddDebug();
  
          app.UseApplicationInsightsRequestTelemetry();
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
              app.UseBrowserLink();
          }
          else
          {
              app.UseExceptionHandler("/Home/Error");
          }
  
          app.UseApplicationInsightsExceptionTelemetry();
  
          app.UseStaticFiles();
  
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
      }
  }
  </code></pre>
  
  <p><strong>program.cs</strong></p>
  
  <pre><code>public static void Main(string[] args)
          {
              var host = new WebHostBuilder()
                  .UseKestrel()
                  .UseContentRoot(Directory.GetCurrentDirectory())
                  .UseIISIntegration()
                  .UseStartup&lt;Startup&gt;()
                  .Build();
  
              host.Run();
          }
  </code></pre>
  
  <p>my goal is to have this run on iis.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <blockquote>
    <h1>Software: Microsoft Internet Information Services 8.5</h1>
    
    <h1>Version: 1.0</h1>
    
    <h1>Date: 2016-12-06 23:49:44</h1>
    
    <h1>Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus</h1>
    
    <p>sc-win32-status time-taken 2016-12-06 23:49:44
    fe80::9c6d:a91b:42c:82ea%12 OPTIONS / - 80 -
    fe80::c510:a062:136b:abe9%12 DavClnt - 200 0 0 1139 2016-12-06
    23:49:47 fe80::9c6d:a91b:42c:82ea%12 OPTIONS /website - 80 -
    fe80::c510:a062:136b:abe9%12 Microsoft-WebDAV-MiniRedir/10.0.14393 -
    200 0 0 46 2016-12-06 23:49:47 fe80::9c6d:a91b:42c:82ea%12 PROPFIND
    /website - 80 - fe80::c510:a062:136b:abe9%12
    Microsoft-WebDAV-MiniRedir/10.0.14393 - 404 0 2 62 2016-12-06 23:49:47
    fe80::9c6d:a91b:42c:82ea%12 PROPFIND /website - 80 -
    fe80::c510:a062:136b:abe9%12 Microsoft-WebDAV-MiniRedir/10.0.14393 -
    404 0 2 62</p>
  </blockquote>
  
  <p>this is the log message that i get</p>
  
  <p><strong>web.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
  
    &lt;!--
      Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
    --&gt;
  
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/&gt;
      &lt;/handlers&gt;
      &lt;aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>