SharePoint WSP 部署多个环境并使用 SPWebConfigModification
我有 SharePoint 功能,可以修改 web.config (使用 SPWebConfigModification 类)以添加数据库连接字符串。但是这个连接字符串对于我所拥有的 3 个环境是不同的。
我的问题是,有什么方法可以外部化此连接字符串,以便 WSP 在部署期间获取此连接?目前我唯一的选择似乎是为每个环境创建 WSP 项目并生成多个执行完全相同操作的 WSP。
谢谢
I have SharePoint feature that modifies the web.config (using the SPWebConfigModification class) to add the DB connection string. But this connection string is different for the 3 envrionments I have.
My question is there any way for me to externalize this connection string so that the WSP picks up this connection during deployment? Currently my only options seems to be create WSP Project per environment and generate multiple WSP that do exactly the same thing.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与其将其添加到 web.config 中,为什么不使用 SPFarm.Properties 之类的东西呢?
SO - 从分层对象读取/写入商店 - SharePoint
然后,您可以在部署后使用 属性包设置
当然,您还希望确保连接字符串是安全的 -虽然您应该使用 web.config 来做到这一点,但它在 PropertyBag 中更重要,因为其他人更容易使用类似的内容查看
Rather than add it to the web.config why don't use use something like the SPFarm.Properties?
SO - Read/Write from/to Hierarchical Object Store - 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