16,554
社区成员
发帖
与我相关
我的任务
分享
Private Host As ServiceHost = Nothing
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_开启服务.Click
If Host Is Nothing Then
Host = New ServiceHost(GetType(A.Service1))
Dim httpBinding As System.ServiceModel.Channels.Binding = New BasicHttpBinding()
Host.AddServiceEndpoint(GetType(A.IService1), httpBinding, "http://localhost:8002/")
Dim behavior As ServiceMetadataBehavior = New ServiceMetadataBehavior()
behavior.HttpGetEnabled = True
behavior.HttpGetUrl = New Uri("http://localhost:8002/Service1")
Host.Description.Behaviors.Add(behavior)
Host.Open()
End If
End Sub