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.
The 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
SpecSheet
SpecSheetService
DataAccess
I would appreciate your assistance in pinpointing my error.
Thanks,
pat
The 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
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
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
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
I would appreciate your assistance in pinpointing my error.
Thanks,
pat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.