web.config转换不转换

时间:2019-03-21 16:16:52

标签: c# asp.net visual-studio azure visual-studio-2017

我正在将网站应用发布到Azure应用服务。我已经创建了质量检查配置配置文件,并添加了一个匹配的Web.QA.config文件。这是该文件的全部内容(已删节):

<?xml version="1.0"?>
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<!-- In case configuration is not the root element, replace it with root element in source configuration file -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="ida:ClientId" value="9a...54e" xdt:Transform="SetAttributes" xdt:Locator="Match(value)" />
    <add key="ida:ClientSecret" value="vuW...z3kY=" xdt:Transform="SetAttributes" xdt:Locator="Match(value)" />
    <add key="ida:PostLogoutRedirectUri" value="https://....azurewebsites.net/" xdt:Transform="SetAttributes" xdt:Locator="Match(value)" />
  </appSettings>
</configuration>

当我使用QA配置文件将网站发布到Azure App Service时,这些值没有被转换。

我在做什么错了?

1 个答案:

答案 0 :(得分:4)

您在value而不是key上进行匹配。

使用xdt:Locator="Match(key)"