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

发布于 2024-10-10 16:19:32 字数 214 浏览 0 评论 0原文

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情 2024-10-17 16:19:32

与其将其添加到 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文