Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在配置转换中禁用httpGetEnable_C#_Wcf_Web.config Transform - Fatal编程技术网

C# 在配置转换中禁用httpGetEnable

C# 在配置转换中禁用httpGetEnable,c#,wcf,web.config-transform,C#,Wcf,Web.config Transform,我有以下web.config元素: <behaviors> <serviceBehaviors> <behavior name="NameOfThisBehavior"> <ServiceErrorHandler/> <serviceDebug includeExceptionDetailInFaults="true"/> <serviceMetadata httpGetEnable

我有以下web.config元素:

<behaviors>
  <serviceBehaviors>
    <behavior name="NameOfThisBehavior">
      <ServiceErrorHandler/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceAuthorization serviceAuthorizationManagerType="Blablabla"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
我需要在配置转换中将serviceDebug includeExceptionDetailInFaults和serviceMetadata httpGetEnabled设置为false。我认为删除它会很有效,因为我假设默认值为false

这就是我现在正在做的不起作用的事情:

<behaviors>
    <serviceBehaviors>
      <behavior name="NameOfThisBehavior" xdt:Locator="Match(name)" >
        <serviceMetadata httpGetEnabled="false" xdt:Transform="SetAttributes(httpGetEnabled)" />
        <serviceDebug includeExceptionDetailInFaults="false" xdt:Transform="SetAttributes(includeExceptionDetailInFaults)"/>
      </behavior>
    </serviceBehaviors>
</behaviors>

有人能告诉我我遗漏了什么吗?

我在转换后的配置中使用XPath解决了这个问题。 似乎transform thingymajig没有搜索层次结构,所以我必须指出要转换的确切元素

  <serviceMetadata httpGetEnabled="false" xdt:Transform="SetAttributes(httpGetEnabled)"
        xdt:Locator="XPath(/configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/serviceMetadata)" />
  <serviceMetadata/>

好的,也许有点明显,但是你确定你是用正确的配置构建的吗?它不工作了?你是怎么知道它不起作用的。有任何错误或异常吗?@hameedshed这些更改不会显示在预览配置转换中。