问题
I have a question about "Data connections" in azure.
I have an App Service. I published my API app there. In my app I have connection strings (I need to work with databases). Among numerous settings for my app I saw a "Data connections" item:
There you can add new connection (server, login, password). After creation you can look at connection string for this connection:
My questions are: 1. what does it do? (I mean in my app I already have a connection string in Web.config and is there any advantages of using connection string in azure?) 2. how to use this "connection from azure" in my app?
I'll appreciate any help.
回答1:
After you add a Data Connection, you can find that it is configured to Connection strings section under Application settings blade. And for .NET apps, these connection strings are injected into your .NET configuration connectionStrings settings at runtime, overriding existing entries where the key equals the linked database name.
Besides, you can find Data Connection section is under Mobile tab, when we do with Azure Mobile Apps’ Easy Tables, we need Data Connection to connect to a database.
回答2:
Data connections help you create a SQL database in azure and then helps you add the necessary connection string so that you can use it form your app.
If you already have a database/connection string, you can ignore this.
来源:https://stackoverflow.com/questions/45921301/data-connections-in-azure