Webconfig覆盖Azure云服务 [英] Webconfig overrides for Azure Cloud Services

查看:91
本文介绍了Webconfig覆盖Azure云服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Azure云服务的Web角色web.config中有一个数据库连接字符串.在开发时,它指向本地主机,但是在部署时,我要指向生产数据库.使用天蓝色网站,您可以使用天蓝色门户覆盖web.config设置和连接字符串,但是如何使用云服务来做到这一点?

此外,在新的Azure门户中,它表示Cloud Services (经典),这是否已弃用?我应该使用较新的Azure功能托管我的soap/rest webservice吗?

解决方案

使用Web角色,您可以在.cscfg文件而不是Web.config文件中配置连接字符串.然后,您可以根据您的环境更改该配置(例如:ServiceConfiguration.Cloud.cscfg,ServiceConfiguration.Local.cscfg).从门户的所有设置",配置"将使您按此处所述更改配置:

I have a database connectionstring in my Azure cloud service's web role web.config. While developing this is pointing to localhost, but when deployed I want to point my production database. With azure websites you can override web.config settings and connectionstrings using the azure portal but how do I do this with cloud services?

Also, in the new azure portal, it says Cloud Services (classic) , does this mean deprecated? Should I be using a newer azure feature for hosting my soap/rest webservice?

解决方案

With Web Role, you would configure the connection string in the .cscfg files rather than the Web.config file. Then you could change that configuration depending on your environment (ex: ServiceConfiguration.Cloud.cscfg, ServiceConfiguration.Local.cscfg). From the portal, All settings, Configuration will let you change the configuration as described here: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-configure-portal/.

In terms of deprecation, the new PaaS model for Azure is a continuum from IaaS to PaaS. For instance, Worker Roles v2 would be the VM Scale sets as described by Mark Russinovich in his talk at //build2015. cf slide 19 in the slide view of this talk. Service Fabric will also play an important role. For simpler usages, Web Apps is the way to go.

这篇关于Webconfig覆盖Azure云服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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