将reactjs和.net 4.8后端部署到iis时遇到问题 [英] Having trouble deploying reactjs and .net 4.8 backend to iis

查看:50
本文介绍了将reactjs和.net 4.8后端部署到iis时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我尝试使用.net 4.8后端和reactjs作为前端来部署应用程序.我遵循了这个

发布:

我如何构建它并进行部署,以使"dist"构件最终出现在"/ClientApp/dist"中,并为此创建文件夹"dist"?

解决方案

我用一个简单的示例进行了测试,在webpack.config.js中将输出指定为 ./ClientApp/dist/.

在本地Visual Studio上

运行 npm run build ,将自动在根目录中创建 clientApp/dist 文件夹.但是,如果您使用托管代理在azure devops中运行,则创建的文件夹将不会显示在存储库中,因为已将项目签出到代理,这是正常的.

发布构建工件失败,并显示以下错误:找不到发布路径:d:\ a \ 1 \ a \ ClientApp \ dist \

此错误是由于发布路径指定不正确,您需要指定正确的发布路径.就我而言,它运作良好:

So I have tried deploying an application using .net 4.8 backend and reactjs as frontend. I followed this guide.

I built both agent steps, both artifacts in release but when its deploy the contents of the 'dist' artifacts does not go in to '/ClientApp/dist' its just dumped in the rootfolder. Also, there is no 'dist' folder in the repo, I want this to be created, and that is also supposed to happen according to this tutorial. I run webpack and the output is './ClientApp/dist/'.

I've tried putting the frontend build step Target folder to: buildvariables + /(projectname)/ClientApp/dist', just '/ClientApp/dist', just '/ClientApp/' but it either dumps it in the root folder or I get a build error like this:

Publishing build artifacts failed with an error: Not found PathtoPublish: d:\a\1\a\ClientApp\dist\

Here are some images of the steps:

Build:

Release:

How do I build this, and deploy it so that the 'dist' artifact ends up in '/ClientApp/dist' and the folder 'dist' is created for it?

解决方案

I tested with a simple sample, specify output in webpack.config.js as ./ClientApp/dist/.

Run npm run build on the local visual studio , clientApp / dist folder will be automatically created in the root. But if you use hosted agent to run in azure devops, the created folder will not be displayed in the repo, because the project has been checked out to the agent, this is normal.

Publishing build artifacts failed with an error: Not found PathtoPublish: d:\a\1\a\ClientApp\dist\

This error is due to the incorrect specification of your publish path,you need to specify the correct publish path. In my case,it works well:

这篇关于将reactjs和.net 4.8后端部署到iis时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆