【发布时间】:2021-11-06 05:24:25
【问题描述】:
我正在使用 Visual Studio 2019 创建一个谷歌云功能,我已经在 postman 中测试了代码并且它工作正常,我正在使用 cmd 使用以下命令进行部署:
gcloud functions deploy my-first-function --region=southamerica-east1 --entry-point dataVerification.FunctionVerifyData --runtime dotnet3 --trigger-http --allow-unauthenticated
但我收到以下错误:
不知道为什么会出现这个错误,代码是可以运行的,没有任何异常。
我正在使用的测试代码如下:
using Google.Cloud.Functions.Framework;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using System.IO;
namespace Data_Verification
{
public class VerifyData : IHttpFunction
{
/// <summary>
/// Logic for your function goes here.
/// </summary>
/// <param name="context">The HTTP context, containing the request and the response.</param>
/// <returns>A task representing the asynchronous operation.</returns>
public async Task HandleAsync(HttpContext context)
{
string body = await new StreamReader(context.Request.Body).ReadToEndAsync();
await context.Response.WriteAsync(body + " ");
await context.Response.WriteAsync(context.Response.StatusCode.ToString());
}
}
}
【问题讨论】:
-
您有更多关于 Cloud Build 或 Cloud Logging 的详细信息吗?
-
嗨,我设法解决了问题,正如我在下面的帖子中所说,我没有日志了,但是,我记得安装 .Net Core SDK 包时出错
标签: c# .net-core deployment google-cloud-functions