0
votes

I'm setting up a server to host an application I made with ASP.NET Core 2.0.3. I'll be running this application on a Windows Server 2012 R2 server, using IIS 8.5. I followed this Microsoft tutorial to set up the environment.

If I run (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name in PowerShell.

It tells me I'm running the right version of the runtime environment and by running dotnet MyProject.dll it runs the project on port 5000 and I can access it from the server. But when accessing with the server URL, this is the page I see:

Enter image description here

The .NET CLR Version of the application pool is set to No Managed Code and this is my web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
      <rewrite>
         <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
               <match url=".*" />
               <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
               </conditions>
               <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
         </rules>
      </rewrite>
      <modules runAllManagedModulesForAllRequests="false">
         <remove name="WebDAVModule" />
      </modules>
      <handlers>
         <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments="C:\inetpub\wwwroot\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
      <security>
         <requestFiltering>
            <requestLimits maxAllowedContentLength="3221225472" />
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

I also tried to remove the rewrite rules and nothing changes. And there is no error log created.

I'm lost on what else I can try. How can I fix it?

1

1 Answers

0
votes
  1. Ensure that you have UrlRewrite IIS extension installed.
  2. Ensure that Application Pool identity user IIS AppPool{AppPoolName} must have read permissions on the published website folder

Go to your published website directory and search for Application Pool Identity user which has format IIS AppPool{AppPool Name} e.g. IIS AppPool\DefaultWebsite and give it read permissions

enter image description here

In IIS Manager select your website in the left pane and then in right pane double click the HandlerMappings icon to ensure that handlers list show up.