Start--> Programs-- >Microsoft Visual Studio 2008-- > Microsoft Visual Studio 2008.
Step 2:
File-- >New Project-- >Web-- >WCF Service Application-- >Name the Solution (e.g. MyFirstWCFApplication) and Save.
It will generate following Files structures.
Step 3:
Click on Default file named (IService1.vb). It creates default
1.
' NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
Public Interface IService1
Function GetData(ByVal value As Integer) As String
Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
' TODO: Add your service operations here
End Interface
2.
' Use a data contract as illustrated in the sample below to add composite types to service operations.
Public Class CompositeType
Private boolValueField As Boolean
Private stringValueField As String
Public Property BoolValue() As Boolean
Get
Return Me.boolValueField
End Get
Set(ByVal value As Boolean)
Me.boolValueField = value
End Set
End Property
Public Property StringValue() As String
Get
Return Me.stringValueField
End Get
Set(ByVal value As String)
Me.stringValueField = value
End Set
End Property
End Class
Note:
1. In
2. Each
3. Add the Functions like to invoke or Expose.
3. All defined or renamed Interfaces references must be updated in Web.config file.
4. In
Step 4:
Now Click on Service1.svc.vb a class file that Implement s the defined Contracts. Define the function defined by Interface and save this file.
Step 5:
Build the application.
After Building the application this Application can be used by Client Applications in different ways.
1. By Adding Service reference Locally
2. By Hosting it on IIS
No comments:
Post a Comment