Как получить доступ к базе данных, развернутой приложению AutoHosted?
-
10-12-2019 - |
Вопрос
Я развернул приложение AutoHosted для SharePoint 2013 (онлайн).
В веб-проекте моего проекта моего приложения Autohosted есть база данных, которая, таким образом, развернута на удаленной сети (в Windows Azure), когда мое приложение AutoHosted используется.
Но я хотел бы знать, можно ли получить доступ к этой базе данных с другого места, чем внутри удаленной сети моего AutoHosted App?
В настоящее время я не смог найти ни одной строки подключения или что-то еще, что может позволить мне добраться до базы данных развернутой удаленной сети, у кого-нибудь есть идея или решение об этом?
Большое спасибо за вашу помощь!
Решение
It is actually possible. If you follow this post http://msdn.microsoft.com/en-us/library/office/apps/fp179902.aspx to include the database in your app, you have to create a SqlAzureConnectionString app setting.
When you publish this app and use it, the connectionstring is replaced with the connectionstring for the sql azure database. If you write this setting to a page, you are able to see the actual connectionstring. It will look something like this:
"Data Source=b2p09toyr4.database.windows.net;Initial Catalog=db_a6d1dee5_4ee6_47f3_ba44_9858f706f141;User ID=db_a6d1dee2_4ee6_47f3_ba45_9858f706f141_dbo;Password=21F4balh/453.Pq"
You are then able to create a connection with SQL Management Studio. (Don't forget to expand the options and connect to your database because you can't connect with the master database)