简体   繁体   English

SharePoint WSP部署多个环境并使用SPWebConfigModification

[英]SharePoint WSP deployment multiple environments and uses SPWebConfigModification

I have SharePoint feature that modifies the web.config (using the SPWebConfigModification class) to add the DB connection string. 我有SharePoint功能,可以修改web.config(使用SPWebConfigModification类)以添加数据库连接字符串。 But this connection string is different for the 3 envrionments I have. 但是对于我的3种环境,此连接字符串不同。

My question is there any way for me to externalize this connection string so that the WSP picks up this connection during deployment? 我的问题是我有什么办法可以外部化此连接字符串,以便WSP在部署期间选择此连接? Currently my only options seems to be create WSP Project per environment and generate multiple WSP that do exactly the same thing. 当前,我唯一的选择似乎是在每个环境中创建WSP Project,并生成多个完全相同的WSP。

Thanks 谢谢

Rather than add it to the web.config why don't use use something like the SPFarm.Properties? 为何不将其添加到web.config中,而不使用SPFarm.Properties之类的东西?

SO - Read/Write from/to Hierarchical Object Store - SharePoint SO-从/向分层对象存储读取/写入-SharePoint

You could then modify/add the connection string after deployment using something like Property Bag Settings 然后,您可以在部署后使用“ 属性包设置”之类的方法修改/添加连接字符串。

Of course you also want to ensure the connection string is secure - and whilst you should be doing that with web.config its more important in the PropertyBag as its easier for others to view using something like 当然,您还想确保连接字符串是安全的 -同时您应该使用web.config来做到这一点,它在PropertyBag中更重要,因为它可以让其他人更轻松地使用类似

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM