[WCF] No endpoint defined
Hello,
J'ai créé un service WCF hosté dans une application console.
Le hic, c'est que le service s'arrête car :
Citation:
Envoyé par WCF Service Host
The service cannot be started. This service has no endpoint defined. Please add at least one endpoint for the service in config file and try again.
Pourtant, j'ai bien un endpoint dans le fichier de config (2 en fait, mais le 2e avec l'adresse "mex", je ne sais pas encore d'où il vient n'y à quoi il sert.. Je dois encore creuser)
Voici le fichier de config de l'application console :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings />
<services>
<service name="Server.InvoiceService">
<clear />
<endpoint address="" binding="netTcpBinding" contract="Contracts.IInvoiceService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Server/InvoiceService/" />
<add baseAddress="net.tcp://localhost:8732/Server/InvoiceService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="False"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration> |
Et voici le code de l'application console qui host le service.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Imports System.ServiceModel
Imports Contracts
Imports Server
Module Module1
Sub Main()
Using host As New ServiceHost(GetType(InvoiceService))
'host.AddServiceEndpoint(gettype(IInvoiceService), New NetTcpBinding,"net.tcp://localhost:8732/Server/InvoiceService/")
host.Open()
Console.WriteLine("Service started")
console.ReadLine()
End Using
End Sub
End Module |
Dernièrement, j'ai ajouté la ligne qui est commenté histoire de testé en ajoutant un endpoint avant d'ouvrir le service. En faisant, il me râle dessus en disant qu'il y a déjà un endpoint qui utilise cette adresse... Faudrait savoir !
Help please :oops: