0

我正在尝试使用 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)" />

当我在调试配置中运行(带或不带调试模式)时,我收到此行无法编译的错误:

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

那么为什么没有发生转变呢?

谢谢,

4

1 回答 1

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>

希望这可以帮助!

于 2012-06-06T13:54:53.447 回答