Imports System
Imports System.Type
Imports System.ServiceModel
Imports System.ServiceModel.Description
Imports ClassLibrary1
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tcpa As New Uri("net.tcp://localhost:8000")
Dim sh As New ServiceHost(System.Type.GetType("ClassLibrary1.MyServiceClass,ClassLibrary1"), New Uri("net.pipe://localhost"), tcpa)
Dim tcpb As New NetTcpBinding
Dim mbehave As New ServiceMetadataBehavior
sh.Description.Behaviors.Add(mbehave)
sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex")
sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexNamedPipeBinding, "mex")
sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), tcpb, tcpa)
sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), New NetNamedPipeBinding, New Uri("net.pipe://localhost"))
sh.Open()
End Sub
End Class
Imports System.Type
Imports System.ServiceModel
Imports System.ServiceModel.Description
Imports ClassLibrary1
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tcpa As New Uri("net.tcp://localhost:8000")
Dim sh As New ServiceHost(System.Type.GetType("ClassLibrary1.MyServiceClass,ClassLibrary1"), New Uri("net.pipe://localhost"), tcpa)
Dim tcpb As New NetTcpBinding
Dim mbehave As New ServiceMetadataBehavior
sh.Description.Behaviors.Add(mbehave)
sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex")
sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexNamedPipeBinding, "mex")
sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), tcpb, tcpa)
sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), New NetNamedPipeBinding, New Uri("net.pipe://localhost"))
sh.Open()
End Sub
End Class
No comments:
Post a Comment