.NET Core Entity Framework on AWS

I have a web application written in .NET Core using Entity Framework to connect to a SQL Server database. Everything works fine. The setup / production environment for the app is AWS Elastic Beanstalk, and I seem to be stuck on how to get the app to connect to the database there.

I have created an RDS (SQL Server) database under Elastic Beanstalk application.

Connection string:

user id=[USER];password=[PASSWORD];Data Source=[SERVER].rds.amazonaws.com:1433;Initial Catalog=Development

      

Creating DbContext:

services.AddDbContext<MyDbContext>(o =>
                o.UseSqlServer(Configuration["Db:ConnectionString"]));

      

The application does not start based on the following line in Startup.cs:

dbContext.Database.EnsureCreated();

      

+3


source to share





All Articles