Azure Web App收到“您没有查看此目录或页面的权限".启动应用程序时 [英] Azure Web App getting "You do not have permission to view this directory or page." when launch app
问题描述
我正在使用带有Express的点头js.我已经在我的本地计算机上对其进行了测试,并且该页面非常容易拉出.用
启动服务器 节点index.js
据我了解,我不需要显式定义web.config,所以我不需要.我
这是我的文件
index.js
const http = require('http');const fs = require('fs');const express = require('express');const app = express();app.get('/',(req,res)=> {res.send('Hello World')})app.get('/api/courses',(req,res)=> {res.send([1,2,3])})app.listen(3000,()=> console.log('listening'))
package.json
{名称":"geoscavenge",版本":"1.0.0&"," description":","main":"index.js",脚本":{"test":"echo \"错误:未指定测试\"&&1号出口"},存储库":{"type":"git","URL":"https://geoscavenge.scm.azurewebsites.net:443/geoscavenge.git"},关键字":[],作者":",许可证":"ISC",依赖项":{表达":"^ 4.17.1";}}
此问题通常是由于缺少 web.config
引起的.
解决方案:
-
在Linux环境中部署Web应用.
-
仍然使用Windows环境,手动添加web.config文件,您可以参考
I'm using nods js with express. I've tested it on my local machine and the page pulls up easy enough. start server with
node index.js
from my understanding I don't need to explicitly define the web.config so I haven't. I
here are my files
index.js
const http = require('http'); const fs = require('fs'); const express = require('express'); const app = express(); app.get('/', (req, res) => { res.send('Hello World') }) app.get('/api/courses', (req, res) => { res.send([1,2,3]) }) app.listen(3000, () => console.log('listening'))
package.json
{ "name": "geoscavenge", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "https://geoscavenge.scm.azurewebsites.net:443/geoscavenge.git" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "express": "^4.17.1" } }
解决方案This problem is generally caused by the lack of
web.config
.Solution:
Deploy the webapp in the Linux environment.
Still use the windows environment, manually add the web.config file, you can refer to https://github.com/Azure-Samples/nodejs-docs-hello-world/blob/master/web.config
The easiest way is to use git for deployment. In git deployment, git will automatically create a
web.config
file.
这篇关于Azure Web App收到“您没有查看此目录或页面的权限".启动应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!