由于IsBase64Encoded属性,未编译C#AWS LAMBDA APIGatewayProxyResponse

时间:2018-09-03 12:37:28

标签: c# amazon-web-services aws-lambda base64 aws-api-gateway

dotnet lambda deploy-function编译器时,抱怨'APIGatewayProxyResponse' does not contain a definition for 'IsBase64Encoded'

代码部分:

  public class Function
  {
      public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest Request, ILambdaContext context)
      {
        return new APIGatewayProxyResponse
        {
            Body = EncodeTo64("foo"),
            IsBase64Encoded = true,
            StatusCode = 200
        };
      }
   }

.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <AWSProjectType>Lambda</AWSProjectType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" />
    <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.3.0" />
    <PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="1.0.0" />
    <PackageReference Include="MongoDB.Bson" Version="2.0.0" />
    <PackageReference Include="MongoDB.Driver" Version="2.0.0" />
    <PackageReference Include="iTextSharp" Version="4.1.2" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.2.0" />
  </ItemGroup>

</Project>

0 个答案:

没有答案