我有一个错误说'无法加载一个或多个请求的类型 . 检索LoaderExceptions属性以获取更多信息'显示在Func.exe命令提示符内 .
当我评论除了具有Table Entity子类的代码之外的所有代码时,我发现了 . 那是代码给我一个例外 .
public class RollCallHistoryEntity : TableEntity
{
public RollCallHistoryEntity() { }
public RollCallHistoryEntity(RollCallTransaction transaction)
{
this.PartitionKey = Convert.ToString(transaction.OrgId);
this.RowKey = Guid.NewGuid().ToString();
this.OrgId = transaction.OrgId;
this.AttendanceId = transaction.AttendanceId;
this.ActionId = transaction.ActionId;
this.HappenedOn = transaction.HappenedOn;
public static class Function1
{
[FunctionName("Function1")]
public static async Task Run([QueueTrigger("queue-trigger", Connection = "tuxdev_STORAGE")]string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
var queueItem = JsonConvert.DeserializeObject<RollCallTransaction>(myQueueItem);
//var historyTable = await Azure.AzureTable.GetTable(Azure.AzureTable.TABLE_ROLLCALL_HISTORY);
//var historyEntity = new Azure.Entity.RollCallHistoryEntity(queueItem);
}
}
不要担心RollCallProcessor,这是我的旧项目 . 我用上面的代码重新创建一个新项目,但仍然有同样的问题 .
1 回答
您可以使用StackTrace类跟踪项目中的异常 .
或者您可以检索ReflectionTypeLoadException.LoaderException属性以获取有关LoaderException的更多信息 .
在Code中捕获异常:
触发器类型中的一些功能可以在 Azure function v2 preview 模板中使用:
例如,BlobTrigger支持v2中的罚款 . 您可以尝试操作azure存储 .
创建Azure功能v2预览:
创建BlobTrigger:
BlobTrigger中的代码:
BlobTrigger中的结果:
因此,您最好选择兼容的平台版本 . 更多细节请参考article .