I am trying to host a default React Application over my local IIS system.
Configurations are as follows
I've installed pre-requisites i.e. asp.net core 2.1 hosting bundle and runtime.
When I published application its directory are as follows
And hosting configuration I made:
But when I run the application on browser it is showing 404 error, It is not finding the application.
However, with ASP.NET CORE 2.0 it is working with the same configurations.
Is this ASP.NET CORE 2.1 removed support for such applications ?
I've been through all possible forums and none of them mentioned how to host 2.1 application with React-Redux template.
Please help
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:
npm run build
from inside the Client App folderPS
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With