【问题标题】:No control over output.config names for WCF configuration无法控制 WCF 配置的 output.config 名称
【发布时间】:2017-06-13 08:08:57
【问题描述】:

在 Visual Studio、SOAP WCF 中,配置参数过于严格。

如果您在 Web config 中设置端点的名称

  <service name="...">
  <endpoint name="**specific**" bindingName="whatever" contract="some IService" 
   bindingConfiguration="configuration Name" 
              binding="basicHttpBinding" bindingNamespace="some space"/>

端点名称将覆盖所有名称:端点名称、端点绑定配置和 output.config 中的绑定名称

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
               <binding name="**specific**">
                  ...
               </binding>
           </basicHttpBinding>
       </bindings>
        <client>
          <endpoint address="address"
            binding="basicHttpBinding" bindingConfiguration="**specific**"
            contract="some IService" name="**specific**" />
    </client>
   </system.serviceModel>
</configuration>

没有办法有这两个名字,绑定配置和端点,设置我想要的方式。例如,如果我在端点中设置了 bindingName,它将使用它在所有三个地方创建 bindingName_ServiceName,同样我无法按照我想要的方式设置这两个端点名称和绑定配置名称。

如果我使用 svcutil 提供任何服务,这些名称通常是不同的。

有没有办法从 Visual Studio 控制它们? (即使从代码中完成它也具有相同的效果。)

我需要这个,因为我的配置文件必须与我拥有的相同。

【问题讨论】:

    标签: visual-studio wcf soap configuration web-config


    【解决方案1】:

    这个问题的解决方式比您希望研究问题的简单性更复杂和令人费解。

    第一部分,要在 output.config 中命名绑定,您需要在 web.config 中使用端点的 name 属性。

    第二部分,要在 output.config 中给出端点名称,您需要覆盖端口命名,如

    中所述

    WSDL-first approach: How to specify different names for wsdl:port and wsdl:binding?

    为什么端点和绑定属性在 output.config 和 web.config 中的含义完全混淆?你告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-19
      • 2010-12-27
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2014-03-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多