ASP.NET Web API on AWS Lambda CORS

0

Hello everyone,

I hope I'm posting this in the right place, this is my first post here.

I'm rather new to the AWS scene and so I apologize if this has been asked and answered before. Believe me I have looked everywhere for the past 3 full days before I allowed myself to ask.

I've made a web API with C# and deployed it to AWS Lambda using the AWS Toolkit for VS 2019. This all goes well, and the API does in fact work, however.. once I try integrating API from my website, I keep getting a CORS error. I've only ever made backends with nodejs in the past, so I have no clue how to enable CORS on my web API.

I've seen a few examples to go on the AWS website and use the website graphical interface to enable CORS, but I cannot seem to find where my web API is deployed to, in order to even access its settings.

I will really appreciate any form of help!

Thank you in advance, Matt

Matt
질문됨 2년 전794회 조회
1개 답변
0

Your API is deployed on AWS Lambda, which means that the container is launched for you when needed.

But what is more important is that before your API there is AWS API Gateway to route HTTP calls to your API.

You can configure CORS on API Gateway. Instruction can be found here.

profile picture
MG
답변함 2년 전
  • First of all thank you very much for the response. The thing is I do not have a single thing listed under AWS Lambda or under API Gateway.

    The only thing I can find listed is the bucket I created when deploying the app for the first time. And that's under S3 -> Buckets. Otherwise, nothing.

  • Matt, check the region where the resources are deployed through your VS 2019. In the AWS console make sure you are in that right region.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠