.net-core - 重新部署 Azure 函数时出错
问题描述
我是 Azure 功能的新手。我从这里有这个简单的 Azure 功能:https ://docs.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio
编码:
public static class HttpExample
{
[FunctionName("HttpExample")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
return name != null
? (ActionResult)new OkObjectResult($"Hello, {name}")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}
}
我部署过一次,效果很好。但是,当今天再次尝试重新部署时。我看到以下错误:
07-06-2020 18:17:47
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__176.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---
可能是什么问题?
解决方案
I am not sure what causes the issue, but what worked for me is that I went to azure portal and stopped the function app then published the function app again from visual studio and started the function app again.
推荐阅读
- python - NameError 问题:未定义名称“vor”
- ffmpeg - 合并两个命令
- r - 查找非连续观察之间的滞后
- ios - dequeueReusableCell (withIdentifier identifier: String, for indexPath: IndexPath) 在每次调用时返回 2 个不同的单元格
- python - 使用 python 访问受密码保护的网络文件夹
- java - 逐行写入文本文件
- python - 为什么我的 Python 列表在每个元素在 for 循环中发生变异后包含相同的元素?
- snmp - 使用 net-snmp 5.8,当使用特殊字符(&、^、$)作为加密密钥和身份验证密钥时,swnpwalk 远程调用失败
- algorithm - 最大价值决策
- raspberry-pi - 微芯片上的那些黑点是什么?