Felix D.
Felix D.

Reputation: 5083

Connecting AzureAppService .Net Backend to SQL Database

I am following this documentation

I've successfully created and modified the project to my needs. Now when it comes to Seeding my Database I would like to Seed and Debug with the "Prod" Database (I know thats not best practice but still .. :D ).

The problem is that in the project you get created from Azure this is the Connectionstring:

connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-[MyAppName]-20161222051819.mdf;Initial Catalog=aspnet-[MyAppName]-20161222051819;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

Now when I want to Debug controllers and stuff in my backend. Can I do this on the actual BackendDB in Azure ?

Or is this .mdf created and stored in Azure when I publish the API to Azure ?

Upvotes: 0

Views: 34

Answers (1)

Adrian Hall
Adrian Hall

Reputation: 8035

  1. The connection string is set within the Azure Portal (use Data Connections menu option within your app service)
  2. You should be using EF Code-First Migrations if you are working with ASP.NET SDK
  3. You can attach the debugger to your running Azure instance within Visual Studio - go to Server Explorer, log into Azure, expand App Services, right-click on your service and select "Attach Debugger" (Make sure you deploy a debug version of the service, not a release version)

For more information, see my book at http://aka.ms/zumobook

Upvotes: 1

Related Questions