无法在 azure 上部署 Web 服务

时间:2021-04-25 18:33:27

标签: node.js azure azure-web-app-service

我整天都在尝试使用 node js 在 azure 中创建 Web 服务, 每次遇到不同的问题时,我似乎无法弄清楚该怎么做, 我创建了一个简单的 express 应用程序并提交给 git,然后将它连接到 azure web 应用程序,就像在本教程中一样: https://www.youtube.com/watch?v=-zjnOTZxuEU

之后我得到这个页面: image

我试图从默认文档中删除hostingstart.html,但是我收到一个页面,告诉我我没有权限, 怎么做才能让它工作?

您可以在此处查看 express 应用:https://github.com/orizvida/new

2 个答案:

答案 0 :(得分:0)

您的 API 方法没有定义路径:

app.get('/',(req,res) => res.send("hello"));

应该是:

app.get('/hellomessage',(req,res) => res.send("hello"));

答案 1 :(得分:0)

如果您是新手,可以按照以下步骤操作:

  1. 通过这个命令创建一个简单的 express 项目:

     npx express-generator
     npm install -g express-generator
     express
     express --view=pug {your-app-name}
     cd {your-app-name}
     npm install
    
  2. 上传到 GitHub。这是文件结构: Unreal Engine 4's blueprint implementation

  3. 在 Azure 上创建 Web 应用程序。 std::call_once

  4. 导航到部署中心,从 GitHub 设置部署,选择您的存储库,然后保存设置。

  5. 转到 GitHub,并查看存储库中的操作日志: enter image description here

  6. 去你的网站看结果:https://dorisnode.scm.azurewebsites.net/,去这个网站看文件结构:https://{your-file-name}.scm.azurewebsites.net/wwwroot/ enter image description here


如果您在创建时基于 Windows 的 Web 应用程序,您可能需要一个 web.config 文件来使 IIS 识别您的项目,请参阅enter image description here .

相关问题