beeweb的app.conf设置的监听端口不生效

使用go get github.com/beego/beeweb下载beeweb项目后,将$(gopath)/bin/beeweb复制到$(gopath)/src/github.com/beego/beeweb下,直接运行,会线下载一些文档,然后提示监听端口8080失败。经过检查,本地的另一个服务已经占用8080端口,但是app.conf中的监听端口却是8090,再检查beego的默认监听端口是8080,所以在这里好奇,为什么监听端口的设置不生效。 app.conf ```go [beego] app_name=Beego Web run_mode=dev http_port_dev=8090 http_port_pro=8090 [lang] types=en-US|zh-CN|ru-RU names=English|简体中文|Russian [github] client_id= client_secret= [app] ``` 版本信息 ```bash hanks-Mac-mini:beeweb hank$ bee version ______ | ___ \ | |_/ / ___ ___ | ___ \ / _ \ / _ \ | |_/ /| __/| __/ \____/ \___| \___| v1.5.2 ├── Beego : 1.7.1 ├── GoVersion : go1.7.3 ├── GOOS : darwin ├── GOARCH : amd64 ├── NumCPU : 4 ├── GOPATH : /Users/hank/gopath:/Users/hank/study/go/testpackage:/Users/hank/study/go/sorter ├── GOROOT : /usr/local/go ├── Compiler : gc └── Date : Monday, 21 Nov 2016 ``` 错误提示 ```bash hanks-Mac-mini:beeweb hank$ ./beeweb 2016/11/21 10:50:17 [D] [log.go:106] Checking file updates 2016/11/21 10:50:19 [D] [log.go:106] Finish check file updates 2016/11/21 10:50:19 [D] [log.go:106] Loading language: en-US 2016/11/21 10:50:19 [D] [log.go:106] Loading language: zh-CN 2016/11/21 10:50:19 [D] [log.go:106] Loading language: ru-RU 2016/11/21 10:50:19 [I] [beeweb.go:52] beego 1.0.0 2016/11/21 10:50:19 [I] [beeweb.go:79] before listen 2016/11/21 10:50:19 [I] [asm_amd64.s:2086] http server Running on http://:8080 2016/11/21 10:50:19 [C] [asm_amd64.s:2086] ListenAndServe: listen tcp :8080: bind: address already in use ```
已邀请:

linuxr

赞同来自: luhuisicnu

试试看下面这样设置 app.conf 通过改 runmode 来执行不同的端口

```
appname =xx-server
runmode = dev

[dev]
httpport = 8081

[test]
httpport = 8082

[prod]
httpport = 8083
```

astaxie - 创造、获取、分享、传播和应用Go

应该是读取配置文件出错了,你的beeweb是在什么地方运行的?

要回复问题请先登录注册