Azure functions Azure函数(ServiceBus)System.Private.CoreLib错误(在本地工作)

Azure functions Azure函数(ServiceBus)System.Private.CoreLib错误(在本地工作),azure-functions,azureservicebus,Azure Functions,Azureservicebus,当我在本地运行我的Azure功能时,它们就像一个符咒。 但是,当我在云中发布并运行它们时,会出现以下错误: [错误]System.Private.CoreLib:执行函数时发生异常:警报。Function.PowerBI:AzureFunction.PowerBI中的Abandom消息 在名为PowerBi的函数中运行名为Alert的函数。 有没有一种方法,也许在Kudu中可以看到实际的错误,或者我应该如何解释 System.Private.CoreLib 代码: [函数名(“警报”)] 公共静

当我在本地运行我的Azure功能时,它们就像一个符咒。 但是,当我在云中发布并运行它们时,会出现以下错误:

[错误]System.Private.CoreLib:执行函数时发生异常:警报。Function.PowerBI:AzureFunction.PowerBI中的Abandom消息

在名为PowerBi的函数中运行名为Alert的函数。 有没有一种方法,也许在Kudu中可以看到实际的错误,或者我应该如何解释

System.Private.CoreLib

代码:

[函数名(“警报”)]
公共静态异步任务警报([ServiceBusTrigger(Topic.Alert,Subscription.PowerBi,Connection=“servicebusconnectionstring”)]消息消息,TraceWriter日志)
{
if(!MessageHandler.Validate(message,Subscription.PowerBi))
返回;
var json=Encoding.UTF8.GetString(message.Body);
var messageCounter=message.SystemProperties.DeliveryCount;
尝试
{
var-alert=Validator.validateLoudalert(json);
如果(警报!=null)
{
var powerBiAlert=alert.ToPowerBiAlert();
var result=await PowerBiService.AddRow(powerBiAlert);
如果(!结果)
抛出新的PowerBiCommandException($“PowerBiService.AddRows返回值:{result}”);
}
}
捕获(例外e)
{
LoggeException(“Function.PowerBi.Alert”,e,new Dictionary(){{“Message”,json});
如果(messageCounter>=5)
{
LoggEvent(“DeadLetterQueue”,newdictionary(){{{“Function”,“Function.PowerBi.Alert”},{“message”,json});
等待QueueService.SendAsync(Queue.Deadletter、JsonConvert.DeserializeObject(json)、Topic.Alert、Subscription.PowerBi);
}
其他的
抛出新的MessageAbundException($“AzureFunction.PowerBi中的Abandom消息”);
}
}

谢谢你的帮助

包含的以下包使Azure功能停止工作:

PackageReference Include=“System.Dynamic.Runtime”Version=“4.3.0”


有没有办法更容易地找到这个问题,这次我只是删除了一行代码,直到我发现了问题所在。非常耗时。即使您建议使用Application Insights(我也这么做),也很难找到真正的问题。我只是花了一些时间,看看它发生在哪一行,并试图删除所有与之相关的NUGET,直到我发现问题。

您可以设置应用程序洞察来监视和搜索函数执行中的错误。如果仍然没有足够的细节,请在打开一个问题,我们将进行调查
    [FunctionName("Alert")]
    public static async Task Alert([ServiceBusTrigger(Topic.Alert, Subscription.PowerBi, Connection = "servicebusconnectionstring")] Message message, TraceWriter log)
    {
        if (!MessageHandler.Validate(message, Subscription.PowerBi))
            return;

        var json = Encoding.UTF8.GetString(message.Body);
        var messageCounter = message.SystemProperties.DeliveryCount;

        try
        {
            var alert = Validator.ValidateCloudAlert(json);
            if (alert != null)
            {
                var powerBiAlert = alert.ToPowerBiAlert();
                var result = await PowerBiService.AddRow(powerBiAlert);
                if (!result)
                    throw new PowerBiCommandException($"PowerBiService.AddRows returned value: {result}");
            }
        }
        catch (Exception e)
        {
            EventLogger.LoggException("Function.PowerBi.Alert", e, new Dictionary<string, string>() { { "Messsage", json } });
            if (messageCounter >= 5)
            {
                EventLogger.LoggEvent("DeadLetterQueue", new Dictionary<string, string>() { { "Function", "Function.PowerBi.Alert" }, { "Messsage", json } });
                await QueueService.SendAsync(Queue.Deadletter, JsonConvert.DeserializeObject<CloudAlert>(json), Topic.Alert, Subscription.PowerBi);
            }
            else
                throw new MessageAbandonException($"Abandom message in AzureFunction.PowerBi");
        }
    }