WCF - Getting security mode and ClientCredentialType using OperationContext

Locked WCF - Getting security mode and ClientCredentialType using OperationContext

  • Friday, 4 December, 2009 4:12 PM
     
     

    Hi all,

    I´m new on the WCF world.

    I have created a service and it´s working fine.

    Now I need to create a database log to register all the information of the service. One of the requirements are getting the security mode and the transport clientCredentialType.

    <bindings>

    <wsHttpBinding>

                            <binding name="wsHttpEndpointBinding">

                                       <security mode="Transport">

                                                   <message clientCredentialType="None"/>

                                                   <transport clientCredentialType="Windows"/>

                                       </security>

                            </binding>

                </wsHttpBinding>

    </bindings>

     

     

    My problem right now is the way of getting this information on the OperationContext. I have explored this object and found this:

     

    This part gives me  the security mode value:

    ((System.ServiceModel.WSHttpBinding)((new System.Collections.Generic.Mscorlib_CollectionDebugView<System.ServiceModel.Description.ServiceEndpoint>(((System.ServiceModel.ServiceHost)operationContext.EndpointDispatcher.ChannelDispatcher.Host).Description.Endpoints)).Items[0].Binding)).Security.Mode”

     

    And here I can get the windows value transport clientCredentialType

    ((System.ServiceModel.WSHttpBinding)((new System.Collections.Generic.Mscorlib_CollectionDebugView<System.ServiceModel.Description.ServiceEndpoint>(((System.ServiceModel.ServiceHost)operationContext.EndpointDispatcher.ChannelDispatcher.Host).Description.Endpoints)).Items[0].Binding)).Security.Transport.ClientCredentialType

     

    The problems is that at this moment I only have 2 endpoint one for the service and the second is the mex endpoint, so I know that the information that I need is on the item[0] of the endpoint array but in a second part of this deployment I will have to add more endpoints on the service and more bindings. So how can I get this information from the right endpoint?

     

    Does anyone knows any other way of getting this kind of information? I really need help on this…

     

    Thanks,


    Jessica
    • Moved by Max Wang_Chinasoft Wednesday, 20 April, 2011 9:48 PM Forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    •  

All Replies

  • Monday, 7 December, 2009 5:36 AM
    Owner
     
     Answered
    You should post your question to WCF forums. This is the Sync forum and I dont see the relation please unless I am missing something.
    This posting is provided AS IS with no warranties, and confers no rights