c# - Azure函数中通过实例id获取主机锁租约的原因是什么?

标签 c# azure asp.net-core azure-storage azure-functions

我正在运行一个具有Azure功能的项目,但它没有运行我的azure功能。我已经下了断点,它也没有命中断点。另外,输出不清楚,因此我可以调试我的代码。有什么方法可以调试代码以找到问题的根本原因吗?

输出:

[3/20/2018 9:39:31 AM] Reading host configuration file 'C:\Users\myname\Source\MyProject\aspnet-core\src\Nec.MyProject.Processors\bin\Debug\netstandard2.0\host.json' [3/20/2018 9:39:31 AM] Host configuration file read: [3/20/2018 9:39:31 AM] { [3/20/2018 9:39:31 AM] "queues": { [3/20/2018 9:39:31 AM] "maxPollingInterval": 1000, [3/20/2018 9:39:31 AM]
"visibilityTimeout": "00:00:00", [3/20/2018 9:39:31 AM]
"batchSize": 1, [3/20/2018 9:39:31 AM] "maxDequeueCount": 5 [3/20/2018 9:39:31 AM] } [3/20/2018 9:39:31 AM] } [3/20/2018 9:39:48 AM] Generating 15 job function(s) [3/20/2018 9:39:48 AM] Starting Host (HostId=windowsmyname-655615619, Version=2.0.11415.0, ProcessId=6320, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=) [3/20/2018 9:39:49 AM] Found the following functions: [3/20/2018 9:39:49 AM] MyCompany.MyProject.Processors.BackOfficeFilesGeneratorJobs.RunTestGeneratorAsync [3/20/2018 9:39:49 AM] [3/20/2018 9:39:49 AM] Job host started Listening on http://localhost:7071/ Hit CTRL-C to exit... [3/20/2018 9:39:50 AM] Host lock lease acquired by instance ID '000000000000000000000000C78D3496'.

Azure 函数:

[FunctionName("GenerateTestOfficeMasterDataFiles")]
public static async Task RunTestGeneratorAsync(
    [QueueTrigger("%MasterDataFiles:Supplier:QueueName%", Connection = "ConnectionStrings:BlobStorageAccount")] BackOfficeFileGeneratorMessage<string> message,
    ExecutionContext context,
    TraceWriter log)

注意:当它是BackOfficeFileGeneratorMessage时工作正常。而不是BackOfficeFileGeneratorMessage<string> .

更新:

public class BackOfficeFileGeneratorMessage<TEntityKey>
{
    public BackOfficeFileGeneratorMessage()
    {
        Items = new MasterDataFileOperationItem <TEntityKey>[0];
    }
    public bool UseStaging { get; set; }
    public string StoreNo { get; set; }
    public bool RefreshAll { get; set; }
    public IEnumerable<MasterDataFileOperationItem <TEntityKey>> Items { get; set; }
}

最佳答案

只需将下一个键:值添加到hosts.json:

"singleton": {
    "listenerLockPeriod": "00:00:15" 
  }

关于c# - Azure函数中通过实例id获取主机锁租约的原因是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49383833/

相关文章:

c# - CSharpAddImportCodeFixProvider 遇到错误并已被禁用

c# - 更新 Entity Framework 实体与其他实体的多种关系

c# - 无需安装即可发布 winforms 应用程序

Azure AD 服务器身份验证,无权限查看目录

azure - 如何在 Azure 容器注册表 REST API 中使用 orderby

c# - 如何正确实现多个 Vector3.Lerps 串联?

azure - 如何在 ArgoCD 中使用 AKS 托管身份连接到 ACR?

c# - 5.7.0 用户未在 asp.net core1 中使用 mailkit 和 strato 服务器进行身份验证

reference - 引用旧类库的 ASP.Net 5 项目

c# - 调试后 Visual Studio 2019 自动删除 nuget 包