【问题标题】:How to get list of protocol mappings for WCF?如何获取 WCF 的协议映射列表?
【发布时间】:2012-07-17 17:05:09
【问题描述】:

我想知道是否有人知道如何获取 WCF 的协议映射列表(有点类似于 ServiceHost.AddDefaultEndpoints 函数为自己所做的),无论映射来自哪里(machine.config、app.config、web.config 等)?

【问题讨论】:

    标签: c# .net vb.net wcf


    【解决方案1】:

    我找到了解决方案。我在这里分享给其他人:

    Dim pms As ProtocolMappingSection = CType(ConfigurationManager.GetSection("system.serviceModel/protocolMapping"), ProtocolMappingSection)
    Dim pmc As ProtocolMappingElementCollection = pms.ProtocolMappingCollection
    
    For Each pme As ProtocolMappingElement In pmc
        If String.Compare(pme.Scheme, uri.Scheme, True) = 0 Then
            ' Do something
            Exit For
        End If
    Next
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-27
      • 2012-10-18
      • 1970-01-01
      • 2014-11-13
      • 2019-01-06
      • 1970-01-01
      • 2016-11-02
      相关资源
      最近更新 更多