简体   繁体   English

通过Azure WebApp在本地运行React应用

[英]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.cshtmlPages / 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.

相关问题 在本地运行 React/Rails 应用程序 - Running a React/Rails app locally 通过 FTP 将 React 应用程序部署到 Azure WebApp - Deploying React app via FTP to Azure WebApp 为什么我的 React 应用程序可以在本地运行,但不能在 Azure 上运行? - Why does my React app work locally but not on Azure? 如何让 React.js 应用在 Azure 应用服务上运行? - How to get a React.js app running on Azure App Services? 在Azure Web应用中运行React软件包不会加载json文件 - running react bundle in Azure web app does not load json file Styles 在本地工作,但在使用 tailwindcss 在反应应用程序上运行“npm run build”时无法正确应用 - Styles working locally but not applied properly when running `npm run build` on react app with tailwindcss 部署到 Heroku 但在本地运行时,React 应用程序中的“.filter 不是函数”错误消息 - '.filter is not a function' error message in React app when deployed to Heroku but not when running locally 我在 apache2 服务器上本地运行一个反应应用程序。 它给出了错误 URL not found on this server - I am running a react app locally on apache2 server. It gives error URL not found on this server 通过博览会运行的本机应用程序中的守​​望者警告 - watchman warning in react native app running through expo Github 动作未通过反应测试,在本地运行 - Github action failing react test, running locally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM