【发布时间】: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