WCF service name and binding name

Scenario

I have two WCF services combined into one App.Config file. I can not start the application (the application compiles, but does not work when services are initialized).

Question

I am wondering if you need to set the service name to the same as something else, which is also defined as part of the service as a whole?

ERROR

TypeInitializationException

{The "MurexUploadObjects.ResponseService" service has zero application endpoints (without infrastructure). This may be because the configuration file was not found for your application, or because no service element matching the service name could be found in the configuration file, or because the endpoints were not 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> 
+4
source share
1 answer

The service name must be the full name of your class of service, including the namespace, for example.

 <service name="YourServiceNamespace.YourService"> 

It can't be anything: the service class name is used by ServiceHost to find the correct service configuration.

+28
source

Source: https://habr.com/ru/post/1306126/


All Articles