web.config转换器什么都不做

时间:2012-06-06 13:48:54

标签: asp.net web-config transformer

我正在尝试使用web.config转换器,但它什么也没做。 这是我在web.config的最后一部分:

 <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IUserInterfaceService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>

</bindings>
<client>
  <endpoint address="http://[WhiteOPS User Interface]:[Port]/UIService/UserInterfaceService/"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserInterfaceService"
    contract="UserInterface.IUserInterfaceService" name="BasicHttpBinding_IUserInterfaceService" />
</client>

这是我的web.debug.config:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <endpoint name="BasicHttpBinding_IUserInterfaceService" address="http://localhost:80/UIService/UserInterfaceService/"
   xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />

  

当我在调试配置中运行(有或没有debuging模式)时,我收到一条错误,该行无法编译:

<endpoint address="http://[WhiteOPS User Interface]:[Port]/UIService/UserInterfaceService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserInterfaceService"
contract="UserInterface.IUserInterfaceService" name="BasicHttpBinding_IUserInterfaceService" />

那为什么转变没有发生?

谢谢,

1 个答案:

答案 0 :(得分:1)

您需要在与其他web.config相同的结构中构建它。

因此,您需要使用相同的<client>标记对其进行包装,以便变换器可以在同一位置找到它。

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <client>
      <endpoint name="BasicHttpBinding_IUserInterfaceService" address="http://localhost:80/UIService/UserInterfaceService/" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
  </client>

希望这有帮助!