I am trying to build a small Web API that uses an Azure SQL Database. The database functionality is exposed via Stored Procedures and in order to call them, I am using Entity Framework for .NET, version 6.4.4 as it gives me access to the .edmx Data Model. I have properly configured the EF so that I can see the SPs and I've added one of them to my model. In my controller, I execute this piece of code:
var dbContext = new MyDbContext();
var result = dbContext.MyStoredProc();
I get an exception when the "MyStoredProc()" method gets called. The exception that is thrown is this:
For now, the connection string is configured to use SQL Authentication, so the user listed in the exception is the user that is configured in the connection string.
I can call the same SP no problems if I use SQL Server Management Studio, within a session open with the same user name and password as I have configured in the connection string.
Why is my application throwing up that exception? Are there specific privileges that I must elevate, in order for the connection to the database to be opened from my Web API?
Any help would be appreciated.
Cheers, Eddie
