2012-07-17 21 views
0

我想知道是否有人知道如何获取WCF的协议映射列表(类似于为自己所做的功能为其自身所做的功能),无论映射来自何处(machine.config,app .config,web.config等)。如何获取WCF的协议映射列表?

回答

0

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

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