使用的ConnectionString在WebJob在Azure上 [英] Use connectionstring in WebJob on Azure

查看:187
本文介绍了使用的ConnectionString在WebJob在Azure上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种简单的方式来分享网站和WebJob在Azure之间的连接字符串?
我已经发现的唯一方法是阅读从控制台应用程序的web.config,但它看起来并不适合我。

Is there an easy way to share connection string between website and WebJob on Azure? The only way I found already is to read web.config from console application, but it doesn't look good for me.

推荐答案

Azure的网站和WebJob共享上的Azure门户设置应用程序设置/连接字符串。
因此,假如你使用的是.NET控制台应用程序作为WebJob,只要使用 ConfigurationManager中来得到你的连接字符串(帮助测试它,只是你的app.config有相同的连接字符串键)。

The Azure website and WebJob are sharing the application settings/connection strings set on the Azure portal. So assuming you're using a .NET console application as a WebJob, just use ConfigurationManager to get your connection string (to help test it, just have your app.config have the same connection string key).

如果你不使用.NET控制台应用程序,连接字符串中的环境,让你可以查询他们。

If you're not using .NET console application, the connection strings are in the environment so you can just query for them.

这篇关于使用的ConnectionString在WebJob在Azure上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆