【问题标题】:web.config transformer does nothingweb.config 转换器什么都不做
【发布时间】:2012-06-06 21:54:53
【问题描述】:

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

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

谢谢,

【问题讨论】:

    标签: asp.net web-config transformer


    【解决方案1】:

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

    所以你需要用相同的&lt;client&gt;标签包裹它,以便转换器可以在相同的位置找到它。

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

    希望这会有所帮助!

    【讨论】:

    • 感谢您的评论,我已经这样做了(实际上我从系统模型节点构建了整个树),我还尝试使用“替换”而不是“setAttributes”,它还是不行……
    猜你喜欢
    • 2011-09-15
    • 2013-04-18
    • 2014-05-09
    • 2019-03-08
    • 2016-12-24
    • 2017-04-18
    • 2011-08-03
    • 2014-05-11
    • 2014-09-10
    相关资源
    最近更新 更多