【发布时间】:2018-08-23 16:43:53
【问题描述】:
我收到一条错误消息,提示“无法加载一种或多种请求的类型。检索显示在 Func.exe 命令提示符内的更多信息的 LoaderExceptions 属性。
我在注释除具有表实体子类的代码之外的所有代码时发现。那就是代码给我一个例外。
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,这是我的旧项目。我用上面的代码重新创建了一个新项目,但仍然有同样的问题。
【问题讨论】:
-
如果你能提供有关 RollCallProcessor 的代码,那会更有帮助。这是一个类似的article,看来是.NET Framework版本的问题。
-
有没有办法查看 LoaderException 堆栈跟踪。
-
也许您可以捕获异常以获取更多信息。
-
对我来说,当我依赖一个 x64 项目时发生了这个异常。我找不到实际读取 LoaderExceptions 属性的方法,但解决方案是在 x64 主机中运行函数,使用这篇文章:henkboelman.com/azure-function-x64-dev-setup
标签: c# azure azure-functions azure-table-storage