我正在尝试将新的 Azure Functions 连接到本地 SQL Server 数据库。 Microsoft 文档提到这是可能的,但我无法弄清楚,也没有看到任何有关使用 Azure Functions 专门设置本地数据库的教程。
我想做类似的事情tutorial .
public static async void Run(TimerInfo myTimer, TraceWriter log)
{
var str = ConfigurationManager.ConnectionStrings["on-prem-connection"].ConnectionString;
//open connections and call db here - I know this
}
我可以按照与上面视频类似的方式来设置连接字符串,然后在 Azure Function 中引用该连接字符串吗?如果是的话,那是怎么做到的。
谢谢你。
最佳答案
您需要使用混合连接之类的东西。查看以下链接。我希望它有帮助: https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-connect-on-premises-sql-server/
关于Azure Functions 连接到本地 SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37398205/