简体   繁体   English

在门户中运行Azure功能时发生内部服务器错误

[英]Internal server Error when running Azure Function in the Portal

I have the following function: 我有以下功能:

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();
    }
}

function.json: function.json:

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.26",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "httpTrigger",
      "methods": [
        "post"
      ],
      "authLevel": "function",
      "name": "req"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/AzureAppDomainRegistration.dll",
  "entryPoint": "AzureAppDomainRegistration.FunctionCheckEmail.Run"
}

host.json: host.json:

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

local.settings.json: 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"
  }
}

When I try to call this function here: 当我尝试在此处调用此函数时:

在此处输入图片说明

I get Internal server Error . 我收到Internal server Error What is wrong? 怎么了? I spent half of day for it... 我花了半天时间...

According to your description, it seems that nuget package WindowsAzure.Storage (verion 9.3.3) breaks the output binding. 根据您的描述,nuget软件包WindowsAzure.Storage (verion 9.3.3)似乎破坏了输出绑定。 So, you could use ICollector and IAsyncCollector as parameter types for Storage Queue output bindings. 因此,您可以将ICollectorIAsyncCollector用作存储队列输出绑定的参数类型。

[Queue("101functionsqueue", Connection = "AzureWebJobsStorage")] ICollector<Customer> queueCollector

For more details, you could refer to this article . 有关更多详细信息,请参阅本文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM