【问题标题】:AWS LambdaException Unable to Load TypeAWS LambdaException 无法加载类型
【发布时间】:2017-09-26 13:40:28
【问题描述】:

这是我的第一个 AWS Lambda 函数。我已经解决了大部分知识空白,但是我遇到了这个错误,我在上传函数时从 Test 方法和从 API Gateway 测试方法中都得到了这个错误。

我将其作为 zip 文件上传,而不是其他一些发布方法,因为我使用的是 .NET Core 2.0,而 VS 2017 中的向导只有 .NET Core 1.0 作为选项。

Error: { "errorType": "LambdaException", "errorMessage": "Unable to load type 'WebApplication2.LambdaEntryPoint' from assembly 'WebApplication2, Culture=neutral, PublicKeyToken=null'." }

public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction { protected override void Init(IWebHostBuilder builder) { IConfigurationRoot config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false) .Build();

        builder
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseConfiguration(config)
            .UseStartup<DependencyResolution.Startup>()
            .UseSetting(WebHostDefaults.ApplicationKey, typeof(LambdaEntryPoint).GetTypeInfo().Assembly.FullName) // Ignore the startup class assembly as the "entry point" and instead point it to this app
           .UseApiGateway(); 
    }

有什么可能导致这种情况的想法吗?

【问题讨论】:

    标签: amazon-web-services .net-core aws-lambda asp.net-core-2.0


    【解决方案1】:

    Lambda仅支持 .NET Core 1.0。你不能使用 .NET Core 2.0(至少在这个时候 - 可能会有一点支持)。

    【讨论】:

    • 好的,谢谢。我将其更改为 .NET Core 1.0 并且至少已上传。前往下一个障碍!
    猜你喜欢
    • 1970-01-01
    • 2012-08-14
    • 2015-08-28
    • 2016-03-05
    • 2014-08-09
    • 2015-04-16
    • 2010-09-08
    • 2017-04-13
    • 2014-01-03
    相关资源
    最近更新 更多