Hola gente!

 

Hace un tiempo que no lo pruebo, pero tengo este codigo:

 

    Sub Main()

        Dim host As ServiceHost = Nothing

        ' Consider putting the baseAddress in the configuration system

        ' and getting it here with AppSettings

        Dim baseAddress As Uri = New 
Uri("http://localhost:8080/WCFHelloWorldHost";)

 

        ' Instantiate a new ServiceHOst

        host = New ServiceHost(GetType(HelloWorldService))

        Dim binding As New BasicHttpBinding()

 

        host.AddServiceEndpoint(GetType(IHelloWorld), binding, 
"http://localhost:8080/WCFHelloWorldHost/HelloWorld";)

 

        Dim metadata As New ServiceMetadataBehavior()

        metadata.HttpGetEnabled = True

        metadata.HttpGetUrl = New 
Uri("http://localhost:8080/WCFHelloWorldHost/Mex";)

        host.Description.Behaviors.Add(metadata)

 

        'Dim mexbinding As Binding = 
MetadataExchangeBindings.CreateMexHttpBinding()

        'Dim mexaddress As New 
Uri("http://localhost:4000/WCFHelloWorldHost/HelloMex";)

 

        'host.AddServiceEndpoint(GetType(IMetadataExchange), mexbinding, 
mexaddress)

 

        host.Open()

 

        Console.WriteLine("Press enter to end")

        Console.ReadLine()

 

        host.Close()

    End Sub

 

El ejemplo completo es el Clase5\WCF\WCFHelloWorld3\WCFHelloWorldHost

Que esta en

http://www.ajlopez.com/downloads/CursoPuntoNet/ArqNet200703Clase5.zip

de un curso

http://www.ajlopez.net/ReferenciaVe.php?Id=238

 

Nos leemos!

 

Angel “Java” Lopez

http://www.ajlopez.com/

http://twitter.com/ajlopez

http://friendfeed.com/ajlopez

 

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Leandro Tuttini
Sent: Friday, July 11, 2008 4:14 PM
To: [email protected]
Subject: [puntonet] WCF - Agregar MEX endpoint mediante codigo

 



Hola que tal.

Estoy creando un servicio mediante codigo, este pareciera que funciona bien 
pero no tengo forma de probarlo.
Desde codigo lo invoco pero este no responde, por eso queria usar la metadata 
del servicio para verificar si se hostea bien.

Queria ver como podria agregar el endpoint de metadata para poder consultarlo 
con la herramienta : WcfTestClient.exe.
Esta es un tool que viene con el Visual Studio 2008.

Este es el codigo que estoy usando para registrar el servicio:

            Uri address = new 
Uri("net.tcp://localhost:4000/IClientNotificationService");

            NetTcpBinding binding = new NetTcpBinding(SecurityMode.Message, 
true);
            binding.Security.Message.ClientCredentialType = 
MessageCredentialType.Windows;
            
            ServiceHost host = new 
ServiceHost(typeof(ClientNotificationService));

            ContractDescription contractDescription = 
ContractDescription.GetContract(typeof(IClientNotificationService));

            ServiceEndpoint serviceEP = new ServiceEndpoint(
                                    contractDescription,
                                    binding,
                                    new EndpointAddress(addressOne,
 EndpointIdentity.CreateUpnIdentity(Thread.CurrentPrincipal.Identity.Name)));

            host.Description.Endpoints.Add(serviceEP);

            host.Open();


Encontre un ejemplo de como hacerlo:
http://en.csharp-online.net/WCF_Essentials%E2%80%94Adding_MEX_endpoints_programmatically

Pero la verdad esta medio confuso, por ahi alguno si lo entinde y me lo puede 
pasar en limpio.

En este otro link explica como usar la tool para testear el servicio:
http://www.codeproject.com/KB/WCF/WCF35Utils.aspx

Saludos
Gracias

 

  _____  


¡Buscá desde tu celular! Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch

Responder a