Deploying ASP.NET Core 2.1 React App on IIS server

I think I found the problem. It is something https enable configuration comes with default project of ASP.NET CORE 2.1.

When I hosted it on IIS server it was redirecting it to https url but IIS was not configured for IIS protocol.

For my needs I removed HTTPS redirection from Configure Method of StartUp.cs file

Removed app.UseHttpsRedirection()

It was now redirecting to HTTP


I had a similar issue and it had something to do with publishing both projects at the same time. This is what worked for me:

  1. Publish ASP.Net Core app to a local folder
  2. Delete the build folder in ClientApp
  3. Zip the published folder and copy it to where you want on your IIS Server
  4. Unzip the project on the server
  5. run the command npm run build from inside the Client App folder

PS Make sure the project is marked as an application in IIS Enable Directory Browsing for that project if need Make sure you set homepage in your package.json if it's not in the root directory of your IIS Server


This worked for me.

  1. Its a 2008 Windows Server - not ideal but set application pool to unmanaged code
  2. I Have React 16.8 inside the 2.2 application.
  3. switch to Release build with Production setting - Publish
  4. Change package.json to have homepage pointing at proper location
  5. Add a web.config file to the ClientApp/build folder for the rewrite module

The web.config that is in the build folder looks like this

<configuration>
<system.webServer>
<rewrite>
    <rules>
    <rule name="React Routes" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="/dynamotoolsapi" />
    </rule>
    </rules>
</rewrite>
</system.webServer>
</configuration>

/dynamotoolsapi happens to be the directory where my entire .net solution is , thus change your accordingly.

NO you don't need or want to delete the build folder and have to do that on the server.