VB .net Issues?

Hi,

I have been coding my WCF apps with C# for a long time. A friend of mine asked me to write a WCF app in VB .net. I wrote a very simple hello world program, everything seems to be perfect but when hosting the app i get the error message "Zero application end points defined ................"

Is there anything that has to be done for coding WCF apps in VB .net

Are there any similar problems when coding with VB .net for WCF

Regards,

Suraj




Answer this question

VB .net Issues?

  • Paul ORear MSFT

    Hi Madhu,

         Thanks, your posting helped. I was able to run the application after i added the projectname to the assemblyname.

    I am now able to host the service but i am unable to view the WSDL :(

    Is there anything specific i will have to do in VB .net to get the WSDL of a service

    Please check the attached code. I wud use the url http://localhost:8080/DerivCalc/ to get the WSDL on ie in C# but in VB .net it just doesn't work

    Wondering why there are so many differences the way C# and VB .net works

    regards,

    Suraj

    P.S :

    Code i used

    <configuration>

    <system.serviceModel>

    <services>

    <service type="DerivCalc.DerivCalc.clsDerivCalc">

    <endpoint

    address="http://localhost:8000/SampleIndigoService/"

    binding="basicHttpBinding"

    contract="DerivCalc.DerivCalc.IDerivCalc"

    />

    </service>

    </services>

    </system.serviceModel>

    </configuration>

     

    Public Class Host

    Shared Sub Main(ByVal args As String())

    Dim servicetype As Type = GetType(clsDerivCalc)

    Dim httpBaseAddress As String = "http://localhost:8080/DerivCalc/"

    Dim tcpBaseAddress As String = "net.tcp://localhost:8081/DerivCalc/"

    Dim httpBaseAddressUri As Uri = New Uri(httpBaseAddress)

    Dim tcpBaseAddressUri As Uri = New Uri(tcpBaseAddress)

    Dim BaseAddresses As New Uri(httpBaseAddressUri, tcpBaseAddressUri)

    Dim host As ServiceHost = New ServiceHost(servicetype)

    host.Open()

    Console.WriteLine("Successfully hosted the service")

    Console.ReadKey()

    host.Close()

    End Sub

    End Class



  • Elf

    One thing you can try very quickly is to see whether you're including the automagical VB namespace in the string for your service or endpoint name attribute.

    C# does not add any namespace to the namespace declared in your code. VB, on the other hand, adds the name of the solution (IIRC) to the namespace that YOU use in your code. Therefore, you might have to add the <customVBNamespace>.Normal.User.Namespace.Type to the name="" attribute string.

    You might try that very quickly to see whether that is why your service can't find any endpoints....

    Cheers, Ralph


  • John_NewSys

    Hey Ralph,

    The name of my project is DerivCalc, the name of my assembly is DerivCalc, the name of my class is clsDerivImplementor.

    So i used DerivCalc.Normal.User.DerivCalc.clsDerivImplementor but it didnt work. However when i use DerivCalc.DerivCalc.clsDerivImplementor it works. I didnt understand the "Normal.User" part.

    Thanks,

    Suraj



  • UberNewbie

    for some reason,VB.NET needs fully qualified name,I will try to investigate why it needs different format,but you can implement this solution

    SERVICE CONFIG FOR MY SERVICE:

    =========================

    <services>

    <service name="VBWCFSVC.TestSamples.Testsvc">

    <endpoint address="" binding="basicHttpBinding"

    contract="VBWCFSVC.TestSamples.IEmployeeService" />

    </service>

    </services>

    so in above config

    VBWCFSVC=My projet name

    TestSamples=Name space where my contract and service is defined

    EmployeeService=cotract

    MY SERVICE CODE:

    ===================

    Namespace TestSamples

    <ServiceContract()> _

    Public Interface IEmployeeService

    <OperationContract()> _

    Function Helloworld() As String

    End Interface

    'Service Implementation

    <ServiceBehavior()> _

    Public Class Testsvc

    Implements IEmployeeService



  • Jean van Schalkwyk

    could you please include your config file code and sevice code. I will try to reproduce it at my end.

    Dileep Agarwal



  • bb5178

    Hi Suraj,

    If possible,can you please send me your repro code,I will try to repro here

    -Thank you

    Madhu



  • Harmesh Patel

    yeah,I am able to browse wsdl for above service

    Note:I am using FEB CTP



  • Yasser

    I was able to successfully host the service before, but was not able to generate a proxy using SVCUTIL. I havent tried out your code yet but are u able to generate a proxy or view the WSDL from the code that you have provided above

    Thanks



  • John Ens

    I used only HTTP base address,because you have only HTTP end point in config file

    SEVICE CODE:

    Imports System

    Imports System.ServiceModel

    Namespace WCFSAMPLES

    <ServiceContract()> _

    Public Interface IHello

    <OperationContract()> _

    Function sayhello() As String

    End Interface

    Public Class clsDerivCalc

    Implements IHello

    'Hosting code

    Shared Sub Main(ByVal args As String())

    Dim servicetype As Type = GetType(clsDerivCalc)

    Dim httpBaseAddress As String = "http://localhost:8080/DerivCalc/"

    ' Dim tcpBaseAddress As String = "net.tcp://localhost:8081/DerivCalc/"

    Dim httpBaseAddressUri As Uri = New Uri(httpBaseAddress)

    'Dim tcpBaseAddressUri As Uri = New Uri(tcpBaseAddress)

    'Dim BaseAddresses As New Uri(httpBaseAddressUri, tcpBaseAddressUri)

    Dim host As ServiceHost = New ServiceHost(servicetype, httpBaseAddressUri)

    host.Open()

    Console.WriteLine("Successfully hosted the service")

    Console.ReadKey()

    host.Close()

    End Sub

    Public Function sayhello() As String Implements IHello.sayhello

    Return "Hello World"

    End Function

    End Class

    End Namespace

    SERVICE CONFIG FILE:

    < xml version="1.0" encoding="utf-8" >

    <configuration>

    <system.serviceModel>

    <bindings>

    <basicHttpBinding>

    <binding name="NewBinding" />

    </basicHttpBinding>

    </bindings>

    <services>

    <service name="FOUMS.WCFSAMPLES.clsDerivCalc">

    <endpoint binding="basicHttpBinding" contract="FOUMS.WCFSAMPLES.IHello" />

    </service>

    </services>

    </system.serviceModel>

    </configuration>



  • VB .net Issues?