Question

i have created a default MVC 4 app with web api. so far i have added a few API calls. i would like to use the out of the box membership provider with no customization.

on my local machines i have added two users and added two user roles.

in the api i have added [Authorize] attribute for the API calls class.

It works well and prevents calls to API if the user is not logged in.

However, when i deploy the app on to Amzaon Beanstalk the Register and Login functions are broken. I am getting

Error. An error occurred while processing your request.

in the web.config of the application i have:

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-UserListsActionsTest-20131103214231;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-UserListsActionsTest-20131103214231.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

Also, i have gone to the properties of the project and set "Items to deploy" to all files in this project.

should that not be enough? do i need to create a SQL db on beanstalk?

would greatly appreciate some help.

Was it helpful?

Solution

In my experience, I've used Amazons RDS service to create a SQL Server instance and point my connection string to that in which I'll run all of my Migrations to that database. That or you can point it to whatever SQL Server instance you have with the appropriate connection string.

You can then call update-database and have your Users / User Roles created in the Seed() method.

FYI: You may need to configure certain ports/permissions within the RDS instance to be friendly with the Elastic Beanstalk instance. (Think about security groups)

I would also download the AWS Toolkit for Visual Studio as it'll help get you setup with the database connection string and the ability to publish straight to AWS Elastic Beanstalk.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top