0
votes

I have the following web.config element:

<behaviors>
  <serviceBehaviors>
    <behavior name="NameOfThisBehavior">
      <ServiceErrorHandler/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceAuthorization serviceAuthorizationManagerType="Blablabla"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

I need to set serviceDebug includeExceptionDetailInFaults and serviceMetadata httpGetEnabled to false in my config transform. I think removing it would work as well as I assume that default value is false.

This is what I'm doing now that isn't working:

<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>

Can someone please provide some insight as to what I'm missing?

1
OK, maybe a bit obvious, but are you sure you're building with the correct configuration? - spodger
It isn't working? How did you came to know it isn't working. Any error or exceptions? - Hameed Syed
@HameedSyed The changes don't show up in preview config transform. - Cristoffer Ryrberg

1 Answers

1
votes

I managed to solve it using XPath in the transformed config. Seems the transform-thingymajig doesn't search down the hierarchy, so I had to point out the exact element to transform.

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