代码之家  ›  专栏  ›  技术社区  ›  Oleg Sh

Azure函数:HttpTrigger和输出队列返回“内部服务器错误”

  •  0
  • Oleg Sh  · 技术社区  · 5 年前

    我有以下功能代码:

    public static class FunctionCheckEmail
    {
        [FunctionName("FunctionCheckEmail")]
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            [Queue("email-message-admin-confirmation", Connection = "StorageConnectionString")]CloudQueue outputQueue,
            ExecutionContext context,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            return new AcceptedResult();
        }
    }
    

    Internal Server Error .

    如果我删除队列绑定,那么它可以工作:

    public static class FunctionCheckEmail
    {
        [FunctionName("FunctionCheckEmail")]
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ExecutionContext context,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");
            return new AcceptedResult();
        }
    }
    

    其他带有队列绑定的函数可以正常工作:

    public static class FunctionWarningNotification
    {
        [FunctionName("FunctionWarningNotification")]
        public static void Run(
            [QueueTrigger("emails-warning-notification", Connection = "StorageConnectionString")]string myQueueItem,
            [SendGrid] out SendGridMessage message,
            ExecutionContext context,
            ILogger log)
        {
            //....
        }
    }
    

    主机.json:

    {
      "version": "2.0",
      "extensions": {}
    }
    

    local.settings.json文件:

    {
      "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
        "AzureWebJobsSendGridApiKey": "XXXX",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "StorageConnectionString": "DefaultEndpointsProtocol=https;AccountName=domainregistration;AccountKey=XXXX"
      }
    }
    

    0 回复  |  直到 5 年前
        1
  •  0
  •   Oleg Sh    5 年前

    我找到了解决问题的方法-nuget包WindowsAzure.存储(9.3.3版),拉到我的Azure应用程序与依赖项目,打破了这个绑定