skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. Find the index.html and vite.config.js files.

    Then add <base href="/ExampleApp/" /> in index.html. Like below:

    enter image description here

    Add base: '/ExampleApp/', in vite.config.js file.

    enter image description here

    Then deploy the ReactApp1.Server project again, and host it under ExampleApp folder.

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search