user19440
user19440

Reputation: 75

Publish asp.net web API to Azure, database connection not working

After publishing the web API to Azure in Visual Studio, and adding two SQL databases in the wizard the account database connected itself without problems to the app service in azure. The data containing database, however, did not. How do I tell the app service web API to use that database?

Upvotes: 0

Views: 435

Answers (2)

Sajeetharan
Sajeetharan

Reputation: 222722

You will have to allow certain IP addresses to connect to it. Look at the SQL Database server's Firewall setting. You can the IP address of your computer (or IP range), to access SQL Database

Make sure to enable Allow Azure services and resources to access the server

enter image description here

Upvotes: 1

Martin
Martin

Reputation: 68

Depending on how your solution was created, you will have a "web.config" and/or an "app.config" file.

Open these up and check the "connectionStrings" section. You should have an entry for each database connection. Verify that these are pointing to the proper databases with the proper security.

In Web.config, the "connectionStrings" section is in the section "configuration". In "App.config the connectionStrings section is in the same place.

Upvotes: 1

Related Questions