Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种简单的方法可以在 Azure 上的网站和 WebJob 之间共享连接字符串?我已经找到的唯一方法是从控制台应用程序中读取 web.config,但这对我来说并不好。
Azure 网站和 WebJob 共享在 Azure 门户上设置的应用程序设置/连接字符串。因此,假设您将 .NET 控制台应用程序用作 WebJob,只需使用ConfigurationManager来获取连接字符串(为了帮助测试它,只需让您的 app.config 具有相同的连接字符串键)。
ConfigurationManager
如果您不使用 .NET 控制台应用程序,则连接字符串位于环境中,因此您只需查询它们即可。