I have deployed Asp.net Core with React.js application to IIS. The app is loading if I publish the code in Default Web Site. I have other app running on port 80 so, I have added separate application under Default Web Site but the app is displaying blank page. I verified from network tab that there is not issue in js and css loading.
Assume my app name is ExampleApp and it I have folder ExampleApp inside inetpub/wwwroot.
Example:
- Code published under inetpub/wwwroot =>. http://localhost => working
- Code published under inetpub/wwwroot/ExampleApp. =>. http://localhost/ExampleApp – blank page
Thanks in advance!
- I have installed .net core web hosting bundle package.
- I have installed url rewrite. Not configured anything in iis.
2
Answers
Below are the steps fixed my issue:
Installed .net core web hosting bundle 6.0 (for .net core 6.0). Added "homepage":"/ExampleApp" in package.json file. Replaced BrowserRoute to HashRouter.
Find the
index.html
andvite.config.js
files.Then add
<base href="/ExampleApp/" />
inindex.html
. Like below:Add
base: '/ExampleApp/',
invite.config.js
file.Then deploy the
ReactApp1.Server
project again, and host it under ExampleApp folder.