App Engine タスクハンドラを作成する

このページでは、App Engine タスクを処理するワーカーコードである App Engine タスクハンドラの作成方法を説明します。Cloud Tasks キューは HTTP リクエストをタスクハンドラに送信します。処理が正常に完了すると、ハンドラは 200299 の HTTP ステータス コードをキューに返します。その他の値を返した場合、タスクが失敗し、キューがタスクを再試行します。

App Engine タスクキュー リクエストは、IP アドレス 0.1.0.2 から送信されます。App Engine 環境に送信されるリクエストの IP 範囲もご覧ください。

C#

    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging(builder => builder.AddDebug());
            services.AddRouting();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder