dongyun8138 2016-05-26 11:35
浏览 34

在App Engine上的Go中永远不会调用/ _ah / start

When I deploy my Go application to GAE, the /_ah/start endpoint is never invoked. When I run the following code, the log does not contain the "STARTING" entry and / does not have the X set.

What am I missing?

server.go:

package main

import (
    "net/http"

    "google.golang.org/appengine"
    "google.golang.org/appengine/log"
)

var X string

func init() {
    http.HandleFunc("/_ah/start", start)
    http.HandleFunc("/", meh)
}

func start(w http.ResponseWriter, r *http.Request) {
    X = "!!!!!"
    c := appengine.NewContext(r)
    log.Infof(c, "STARTING")
}

func meh(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("The value is: " + X))
}

app.yaml:

application: my-app
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  secure: always
  script: _go_app
  • 写回答

1条回答 默认 最新

  • dougua4836 2016-06-03 00:31
    关注

    app.yml with manual scaling.

    application: my-app
    version: 1
    runtime: go
    api_version: go1
    
    handlers:
    - url: /.*
      secure: always
      script: _go_app
    
    instance_class: B8
    manual_scaling:
      instances: 5
    

    https://cloud.google.com/appengine/docs/go/an-overview-of-app-engine#scaling_types_and_instance_classes

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?