求vb.net写的win frm 作宿主的wcf代码。
通过iis使用wcf,我试成了,现在想用win frm 作为wcf的宿主,
找了半天,只有c#的代码,虽然转换成vb.net以后,好象没啥问题了,但是就是得不出结果。
我怀疑是不是转换的不对。而且很多属性方法不是很明白他的意思。
谁有vb.net写的win frm 作宿主的wcf代码,给我来一点参考参考。
Private Host As ServiceHost = Nothing
If Host Is Nothing Then
Host = New ServiceHost(GetType(Wcfservice.Service1))
'绑定
Dim httpBinding As System.ServiceModel.Channels.Binding = New BasicHttpBinding()
'终结点
Host.AddServiceEndpoint(GetType(Wcfservice.Service1), 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()
这是关系的代码,我写完了以后,启动他,按那个例子的说明,在浏览器中输入http://localhost:8002/Service1
就应该看到相应的信息了,可是我什么都没有看到。
相应的Wcfservice.Service1已经做了。