I am a junior software developer and to be brief, I recently built an API by creating an ASP.NET Web Application
and choosing Web API
. Added to that was the ADO.NET Entity Data Model
. What it did? All that was done by that API was retrieving data from an Amazon RDS
. Everything worked great, this is an example output
[
{
"demo_id": "id_value",
"demo_name": "data 1",
"demo_specificity": "Total",
"demo_period": "'May'",
"demo_value": 10
},
{
"demo_id": "id_value",
"demo_name": "data 2",
"demo_specificity": "Total",
"demo_period": "'May'",
"demo_value": 544
}
]
Later I was asked to convert it as a serverless app with AWS Lambda
and AWS API Gateway
.
I followed these instructions https://www.jerriepelser.com/blog/aspnet-core-aws-lambda-serverless-application/.
I installed the AWS toolkit on Visual Studio
created an AWS serverless app
and into the solution I added my API project
which I referenced in my AWS serverless app
. This is the project structure
In my API (ObservatoireAPI
) this was my Controller
:
using ObservatoireAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace ObservatoireAPI.Controllers
{
public class ObservatoireController : ApiController
{
public IEnumerable<SLM_RAW_INDICATORS> GetSLM_RAW_INDICATORS()
{
using(gpaEntities entities = new gpaEntities())
{
return entities.SLM_RAW_INDICATORS.ToList();
}
}
}
}
And in my ObservatoireAWS
(AWS Serverless APP) Controller I just called that function this way:
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using ObservatoireAPI.Controllers;
namespace ObservatoireAWS.Controllers
{
[Route("[controller]")]
public class ObservatoireAWSController : Controller
{
[HttpGet]
public IActionResult Get()
{
ObservatoireController api = new ObservatoireController();
var apiResult = api.GetSLM_RAW_INDICATORS();
return Ok(apiResult);
}
}
}
Honestly I'm sure I did everything great, but on launching the app (locally first), I get HTTP Error 500.0 - ANCM In-Process Handler Load Failure
. I tried googling and people were recommending switching between In Process
and Out Process
. I tried the Out Process but it crashed so i left it back the way it was.Not willing to alter configs I didn't understand I preferred opening an issue.
Here are two solution that i tried to implement but that didn't work for me:
Once more thanks.
This is my dotnet --info
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.301\
Host (useful for support):
Version: 3.1.5
Commit: 65cd789777
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
C:\Users\Administrator>