[英]Running React app through Azure WebApp locally
I created a new react app and also a new project on Visual Studio: .NET Framework Web Application, under my Azure subscription. 在Azure订阅下,我在Visual Studio上创建了一个新的react应用程序和一个新项目:.NET Framework Web应用程序。
What should be the process so when I run the Web Application locally, I will see the new react app and not the ASP.NET screen ? 应如何处理,以便当我在本地运行Web应用程序时,将看到新的react应用程序而不是ASP.NET屏幕?
I deployed the new react app to azure so when I run the website I do see the new react app, however when I run it from the .sln file, I get this screen: 我将新的React App部署为天蓝色,因此当我运行网站时,确实看到了新的React App,但是当我从.sln文件运行时,出现以下屏幕:
Thanks in advance! 提前致谢!
I think the step you missed is to update the Index view which is used to generate the website root to include the bootstrapping of the React app. 我认为您错过的步骤是更新Index视图,该视图用于生成网站根目录以包括React应用程序的引导程序。 It should be located at Views/Home/Index.cshtml or Pages/Index.cshtml , depending on the template you used when you created the project. 它应该位于Views / Home / Index.cshtml或Pages / Index.cshtml上 ,具体取决于创建项目时使用的模板。
As a side note, I would consider dropping the ASP.Net project entirely and just use VS Code for the React app, through there you can easily deploy your app to an Azure Storage Account using the new Static website hosting in Azure Storage , thus removing the need for an ASP.Net website. 附带说明一下,我将考虑完全删除ASP.Net项目,仅对React应用程序使用VS Code ,通过该站点 ,您可以使用Azure Storage中托管的新静态网站轻松地将应用程序部署到Azure Storage Account ,从而删除需要一个ASP.Net网站。
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.