Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service Name & Binding Name

Tags:

wcf

service

Scenario

I have two WCF Services combined in a single App.Config file. 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

{"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."}

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>
like image 481
Goober Avatar asked Apr 06 '10 13:04

Goober


People also ask

What is the WCF service?

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.

How do I know if a service is WCF?

If the service is WCF, you will have the service file extension as svc, if it is webservice it will have asmx extension. This will be main indicator if there are no changes for url exposure.

Is WCF a Web service?

Windows Communication Foundation (WCF) allows you to create a service that exposes a Web endpoint. Web endpoints send data by XML or JSON, there is no SOAP envelope. This topic demonstrates how to expose such an endpoint. The only way to secure a Web endpoint is to expose it through HTTPS, using transport security.


1 Answers

The service name must be the fully qualified name of your service class, including the namespace, e.g.

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

like image 140
marc_s Avatar answered Jan 03 '23 16:01

marc_s