【问题标题】:WCF Server without config file没有配置文件的 WCF 服务器
【发布时间】:2009-03-04 19:59:18
【问题描述】:

我厌倦了处理配置文件,所以我尝试仅在代码中设置 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,这将有效。我该如何处理那块?

【问题讨论】:

    标签: .net wcf


    【解决方案1】:
        m_ServiceHost.Description.Behaviors.Add(New ServiceMetadataBehavior())
        m_ServiceHost.AddServiceEndpoint(
                 GetType(IMetadataExchange), 
                 MetadataExchangeBindings.CreateMexTcpBinding(), 
                 "net.tcp://localhost:6595")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      相关资源
      最近更新 更多