Link to home
Start Free TrialLog in
Avatar of mpdillon
mpdillon

asked on

CLASS missing after ADD ServiceReference

I have created two console applications. The first is a WCF server console application. The second is a client to Get info from the WCF server. After starting the WCF server and Adding a ServiceReference to the Client, the Server class is missing from the ServiceReference, See image.
User generated imageThe Server application has four classes. I am assuming I have done something incorrectly in one or more of those classes. The classes are shown below.
Module1
Imports System.ServiceModel
Imports System.ServiceModel.Description
Module Module1
    Dim uri As New Uri("http://localhost:8240/demo/wcf/samples")
    Dim host As New ServiceHost(GetType(SpecSheetService), uri)

    Sub Main()
        Try
            host.AddServiceEndpoint(GetType(ISpecSheet), New WSHttpBinding, "SpecSheetService")
            Dim behavior As New ServiceMetadataBehavior()
            behavior.HttpGetEnabled = True
            host.Description.Behaviors.Add(behavior)

            host.Open()
            Console.WriteLine("The service has been started.")
            Console.WriteLine("Press the ENTER key to terminate service.")
            Console.WriteLine()
            Console.ReadLine()
            host.Close()
        Catch ex As CommunicationException
            Console.WriteLine("Error: {0}", ex.Message)
            host.Abort()
        End Try
    End Sub

End Module

Open in new window


SpecSheet
Imports System.ServiceModel
Imports System.Runtime.Serialization

<DataContract()> _
Public Class SpecSheet
    Private _LotNoString As String
    <DataMember()> _
    Public Property LotNoString As String
        Get
            Return _LotNoString
        End Get
        Set(value As String)
            _LotNoString = value
        End Set
    End Property

    Private _SpecSheetString As String
    <DataMember()> _
    Public Property SpecSheetString As String
        Get
            Return _SpecSheetString
        End Get
        Set(value As String)
            _SpecSheetString = value
        End Set
    End Property
End Class
<ServiceContract(Namespace:="http://demo.wcf.samples")> _
Public Interface ISpecSheet
    <OperationContract()> _
    Function GetSpecSheet(ByVal LotNoString As String) As String
End Interface

Open in new window


SpecSheetService
Public Class SpecSheetService
    Implements ISpecSheet

    Public Function GetSpecSheet(LotNoString As String) As String _
        Implements ISpecSheet.GetSpecSheet
        Return DataAccess.GetSpecSheet(LotNoString)
    End Function
End Class

Open in new window


DataAccess
Public Class DataAccess
    Public Shared Function GetSpecSheet(ByVal LotNoString As String) As String
        Return "Spec sheet base 64 xxxx for Lot No: " & LotNoString
    End Function
End Class

Open in new window


I would appreciate your assistance in pinpointing my error.
Thanks,
pat
ASKER CERTIFIED SOLUTION
Avatar of Mlanda T
Mlanda T
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mpdillon
mpdillon

ASKER

You are exactly correct.
I was following an example on the web. In that example the client program contained a Class reference that my code did not. Thank you for clearing up my misunderstanding.