Route issue on IIS #1420

Closed
opened 2025-08-09 17:20:04 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Sjanchom on 8/25/2016

I try to deploy my react app on IIS. When I add new Web site it work fine.but When I add app to new Application like
Default Web site -->(Add Application) my react app
and I switched application pool to no managed code .And enter url (ip/myreactapp) it have nothing to show on the screen .Any Idea

When page is rendered
In Add Application(ip/myreactapp) Show Element Like this

<div id="my-spa" asp-prerender-webpack-config="webpack.config.js" style="height: auto">
<!-- react-empty: 1 -->
</div>

but In Add new Web Site (ip:8088) Element Show

<div id="my-spa" asp-prerender-webpack-config="webpack.config.js" style="height: auto">
<div data-reactroot="">
   (Work fine here)
</div></div>

This is my code

on react route

`export` default (
    <Route path={`/`} component={App}/>
);`
ReactDOM.render((
  <Provider store={store}>
  <Router routes={routes} history={browserHistory}/>
  </Provider>
), document.getElementById('my-spa'))

on .net core

   app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                       name: "spa-fallback",
                       defaults: new { controller = "Home", action = "Index" });
            });

view/home/index

 <div id="my-spa"
         asp-prerender-webpack-config="webpack.config.js" style="height: auto"></div>
*Originally created by @Sjanchom on 8/25/2016* I try to deploy my react app on IIS. When I add new Web site it work fine.but When I add app to new Application like Default Web site -->(Add Application) my react app and I switched application pool to no managed code .And enter url (ip/myreactapp) it have nothing to show on the screen .Any Idea When page is rendered In Add Application(ip/myreactapp) Show Element Like this ``` <div id="my-spa" asp-prerender-webpack-config="webpack.config.js" style="height: auto"> <!-- react-empty: 1 --> </div> ``` but In Add new Web Site (ip:8088) Element Show ``` <div id="my-spa" asp-prerender-webpack-config="webpack.config.js" style="height: auto"> <div data-reactroot=""> (Work fine here) </div></div> ``` This is my code on react route ``` `export` default ( <Route path={`/`} component={App}/> );` ``` ``` ReactDOM.render(( <Provider store={store}> <Router routes={routes} history={browserHistory}/> </Provider> ), document.getElementById('my-spa')) ``` on .net core ``` app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home", action = "Index" }); }); ``` view/home/index ``` <div id="my-spa" asp-prerender-webpack-config="webpack.config.js" style="height: auto"></div> ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1420
No description provided.