小编Sim*_*n.S的帖子

我的web.config转换不起作用

我正在使用web.config转换来更改生产环境中的链接,但在预览时,转换不会发生..

这是我的代码:

web.Test.config

  <configuration>
    <appSettings>
      <add key ="ELeg" value ="1"/>
    </appSettings>
  </configuration>
  <system.web>
Run Code Online (Sandbox Code Playgroud)

web.Prod.config

  <configuration>
    <appSettings>
      <add key ="ELeg" value="10" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
    </appSettings>
  </configuration>
Run Code Online (Sandbox Code Playgroud)

在prod和test envoirment上预览它时,它不会添加appSetting.

有谁知道问题是什么?

UPDATE

这是我的整个测试转换:

<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of 
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
    finds an attribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB" …
Run Code Online (Sandbox Code Playgroud)

web-config

1
推荐指数
1
解决办法
2613
查看次数

标签 统计

web-config ×1