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
ServiceHost 類找不到相應的說明檔案,這上面開始WCF服務的關鍵陳述句,哪位幫我注釋一下,都有什么用。
他這里只指向上了,一個A專案中的Service1.vb,如果我有很多檔案,如何添加?還是說一個埠只能對應一個檔案?
這方面完全是不懂,請指教。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/135087.html
標籤:VB.NET
上一篇:delphi轉c#
