简体   繁体   English

WCF服务名称和绑定名称

[英]WCF Service Name & Binding Name

Scenario 脚本

I have two WCF Services combined in a single App.Config file. 我在一个App.Config文件中组合了两个WCF服务。 I can't get the thing to run (the application compiles but fails at initialization of the services). 我无法运行(应用程序编译但在初始化服务时失败)。

Question

I'm wondering whether I need to set the service name to be the same as something else that is also defined as part of the service overall? 我想知道我是否需要将服务名称设置为与整体服务中定义的其他内容相同?

ERROR 错误

TypeInitializationException TypeInitializationException

{"Service 'MurexUploadObjects.ResponseService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element."} {“服务'MurexUploadObjects.ResponseService'没有应用程序(非基础结构)端点。这可能是因为没有为您的应用程序找到配置文件,或者因为在配置文件中找不到与服务名称匹配的服务元素,或者因为没有在服务元素中定义端点。“}

CODE

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

The service name must be the fully qualified name of your service class, including the namespace, eg 服务名称必须是服务类的完全限定名称,包括命名空间,例如

<service name="YourServiceNamespace.YourService"> 

It can't be just anything - the name of the service class is used by ServiceHost to find the right service configuration. 它不能只是任何东西 - ServiceHost使用服务类的名称来查找正确的服务配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM