【问题标题】:Is it possible to change WCF UPN (identity) on deployment by Powershell是否可以在 Powershell 部署时更改 WCF UPN(身份)
【发布时间】:2015-07-19 09:23:28
【问题描述】:
我有一个在域帐户下运行的 WCF 网络服务
.我使用 powershell 部署了一个 web 应用程序,该应用程序在 4 个不同的平台(开发、系统测试、用户测试、生产)上托管服务。在每个平台上,我们都有一个域帐户,用于在其下运行 wcf webservice UPN 和 apppool。在我的部署脚本中,我删除并创建了 webapplication 和 apppool。我可以通过 powershell 更改 apppool 帐户取决于平台,但如何更改或覆盖 web.config 中的身份?是否有可以覆盖 wcf 身份的 powershell 命令?
任何帮助将不胜感激。
【问题讨论】:
标签:
c#
wcf
powershell
windows-identity
【解决方案1】:
通常您会使用config transformations 进行这些特定于环境的操作。
在您的情况下,您转换后的 web.config(例如 web.usertest.config)可能如下所示:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.serviceModel>
<client>
<endpoint>
<identity>
<userPrincipalName value="foo@bar.com" xdt:Transform="Replace" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>