title: Can't reach aspnet core application on IIS
body: <p>I published my aspnet core application to an IIS server following the official guide and that all worked fine, when I put the hostname and IP for the IIS in my own machine's hosts file.</p>
  
  <p>However, now that it's all ready, I need others on the network to be able to reach it as well, so I put the hostname in the network DNS, just like I usually do with all my websites.</p>
  
  <p>But now I'm not able to reach the application at all - I'm presuming this is because of the IIS-Kestrel reverse proxy, as the IIS server is now trying to lookup requests using the DNS A-record, which just points to itself. </p>
  
  <p>How do I make this work, so that I can use a network DNS record?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>It seems that the problem is with special characters in the hostname (specifically ø).</p>
  
  <p>Changing the binding and network DNS to a hostname that doesn't contain this special character seems to work.</p>
  
  <p><strong>Settings:</strong></p>
  
  <p>IIS Binding on <a href="http://mysite.domain.dk" rel="nofollow noreferrer">http://mysite.domain.dk</a> (80) </p>
  
  <p>With no DNS records in our network DNS, I can reach the app on my <em>own</em> machine by putting ip/hostname in my hosts file and browsing <a href="http://mysite.domain.dk" rel="nofollow noreferrer">http://mysite.domain.dk</a></p>
  
  <p>As soon as I put the A-record in the network DNS, I'm unable to reach it.</p>
  
  <p>I am (of course) unable to reach the app from the IIS server without any entries in the server hostname, because the server doesn't know where to point <a href="http://mysite.domain.dk" rel="nofollow noreferrer">http://mysite.domain.dk</a> - however, when I put in a binding to the local server network IP (192.168.17.73) I can reach it here both from the server and client.</p>
  
  <p>Putting in the A-record in network DNS I can still reach the app from IP - both server and client, but unable to reach it through hostname.</p>
  
  <p><strong>Edit: code and settings</strong></p>
  
  <p><strong>Program.cs</strong></p>
  
  <pre><code>        var host = new WebHostBuilder()
              .UseUrls("http://localhost:4561")
              .UseKestrel()
              .UseContentRoot(Directory.GetCurrentDirectory())                
              .UseIISIntegration()
              .UseStartup&lt;Startup&gt;()
              .Build();
  
          host.Run();
  </code></pre>
  
  <p><strong>project.json</strong></p>
  
  <pre><code>{
    "dependencies": {
      "Microsoft.AspNetCore.Diagnostics": "1.1.0",
      "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
      "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
      "Microsoft.Extensions.Logging.Console": "1.1.0",
      "Microsoft.AspNetCore.Mvc": "1.1.0",
      "Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.1.0",
      "Microsoft.AspNetCore.StaticFiles": "1.1.0",
      "Microsoft.EntityFrameworkCore": "1.1.0",
      "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
      "Microsoft.EntityFrameworkCore.Tools": {
        "version": "1.1.0-preview4-final",
        "type": "build"
      },
      "SimpleImpersonation": "2.0.1"
    },
  
    "tools": {
      "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
      "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
    },
  
    "frameworks": {
      "net452": {
        "frameworkAssemblies": {
          "System.Configuration": "4.0.0.0"
        }
      }
    },
  
    "buildOptions": {
      "emitEntryPoint": true,
      "preserveCompilationContext": true
    },
  
    "publishOptions": {
      "include": [
        "wwwroot",
        "web.config",
        "Views",
        "logs",
        "app.config"
      ]
    },
  
    "scripts": {
      "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
    }
  }
  </code></pre>
  
  <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;configSections&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;/configSections&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="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/&gt;
      &lt;httpErrors existingResponse="PassThrough"&gt;&lt;/httpErrors&gt;
    &lt;/system.webServer&gt;
  
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"&gt;
        &lt;parameters&gt;
          &lt;parameter value="Data Source=---;Initial Catalog=---;User ID=---;Password=---" /&gt;
        &lt;/parameters&gt;
      &lt;/defaultConnectionFactory&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
  &lt;/configuration&gt;
  </code></pre>