简体   繁体   中英

Deploy React + asp.net core to IIS

I'm using the React template in Visual Studio, and I'm now trying to deploy it to IIS.

My IIS looks like this:

在此处输入图像描述

The application pool look like this:

在此处输入图像描述

After I've published the files to IIS, and I go to the url, nothing happens. When I hit Manage Application->Browse in IIS, nothing happens.

I can use the application if I go to the ClienApp folder in the project, open cmd, and writes dotnet ICON.Breif.UI.dll , then the projects starts.

So I guess it has something to do with the node server when I publish to IIS?

Here's what did the trick for me, got a hint from HERE (apparently this is a known issue). Not the most flexible solution, but it works

  1. In VS, open package.json (in your React App folder - if you used VS template to create the project - it will be called ClientApp)

  2. On top of the file, under "name", "version" or "private" add new item, called "homepage"

  3. for "homepage" value, put "/[YOUR_APP_NAME_IN_IIS]" (forward slash) followed by name of your application exactly as you have it in IIS.

  4. Deploy

IIS 中带有 .Net Core 的 ReactRedux 无法正常工作

It should render now:

工作 IIS react-redux .net 核心与模板

Hope this helps someone

It depends on which version of asp.net core your using, currently I don't which version, if your using asp.net core version 3.0 then: please follow the link: Link: https://dotnetdetail.net/deploy-react-and-asp-net-core-3-0-application-to-iis/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM