我已经厌倦了处理配置文件,所以我试图仅在代码中设置WCF服务。
到目前为止,我有这个:
m_ServiceHost = New ServiceHost(Me)
m_ServiceHost.AddServiceEndpoint(
GetType(Aam.AamServiceFramework.IServiceMonitor),
New NetTcpBinding, "net.tcp://localhost:6000)
m_ServiceHost.AddServiceEndpoint(
GetType(IMetadataExchange),
New NetTcpBinding, "net.tcp://localhost:6500)
m_ServiceHost.Open()
如果我注释掉IMetadataExchange,这是有效的。我该如何处理这件作品?
答案 0 :(得分:4)
m_ServiceHost.Description.Behaviors.Add(New ServiceMetadataBehavior())
m_ServiceHost.AddServiceEndpoint(
GetType(IMetadataExchange),
MetadataExchangeBindings.CreateMexTcpBinding(),
"net.tcp://localhost:6595")