【问题标题】:WCF Service Name & Binding NameWCF 服务名称和绑定名称
【发布时间】:2010-04-06 13:47:04
【问题描述】:

场景

我有两个 WCF 服务组合在一个 App.Config 文件中。 我无法让这个东西运行(应用程序编译但在服务初始化时失败)。

问题

我想知道是否需要将服务名称设置为与其他也被定义为整体服务的一部分的名称相同?

错误

类型初始化异常

{"Service 'MurexUploadObjects.ResponseService' 有零个应用程序(非基础设施)端点。这可能是因为找不到您的应用程序的配置文件,或者因为在配置文件中找不到与服务名称匹配的服务元素,或者因为在服务元素中没有定义端点。"}

代码

<system.serviceModel>
<configuration>

<behaviors>
 <serviceBehaviors>
   <behavior name="Service1Bevhavior">
   </behavior>
   <behavior name="Service2Bevhavior">
   </behavior>
   </serviceBehaviors>
  </behaviors>

   <bindings>
    <netTcpBinding>
      <binding name="tcpBloombergServiceEndPoint" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
          hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
          maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
       <reliableSession ordered="true" inactivityTimeout="00:05:00"
      enabled="true" />
       <security mode="None">
       <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
       <message clientCredentialType="Windows" />
       </security>
     </binding>

     <binding name="TransactedBinding">
     <security mode="None" />
     </binding>

   </netTcpBinding>
   </bindings>

 <services>

 <!--SERVICE ONE-->
 <service name="INSERT NAME HERE">
   <endpoint address="net.tcp://AP434190:8732/BloombergService/"
binding="netTcpBinding"
contract="BloomberPriceListenerService.IBloombergPriceListenerService"
bindingConfiguration="tcpBloombergServiceEndPoint"
name="tcpBloombergServiceEndPoint" />
 </service>

 <!--SERVICE TWO-->
 <service name="INSERT NAME HERE">
   <endpoint address="net.tcp://localhost:8735/private/MurexUploadObjects/ResponseService"
               binding="netTcpBinding"
               contract="MurexUploadObjects.IResponseService"
               bindingConfiguration="TransactedBinding"
               name="TransactedBinding"/>
   </service>
 </services>   

</system.serviceModel>  
</configuration>

【问题讨论】:

  • 错误信息表明您的上传服务名称不正确 - 请查看我的回答
  • 仅供参考,您可以使用服务实现上的 ServiceBehaviorAttribute 的 Name 属性显式设置服务的实际显示“名称”。以george.tsiokos.com/posts/2007/3/13/wcf-service-name.html 为例

标签: wcf service


【解决方案1】:

服务名称必须是服务类的完全限定名称,包括命名空间,例如

<service name="YourServiceNamespace.YourService"> 

它不能只是任何东西 - ServiceHost 使用服务类的名称来查找正确的服务配置。

【讨论】:

  • 我希望我能早点阅读这篇文章...感谢相关信息。
猜你喜欢
  • 2011-02-03
  • 1970-01-01
  • 1970-01-01
  • 2013-12-17
  • 2012-03-28
  • 1970-01-01
  • 2013-07-27
  • 2012-08-10
  • 1970-01-01
相关资源
最近更新 更多