none
WCF RRS feed

  • Question

  • Hi All,

    Can somebody give me the answers for below questions ?

    1. See, my hosted service is chargeable and I want to track the record that who has called/ accessed my service how many time, how can I do it?

    2.How session management is done in WCF ? 

    3. How WCF service is secured?

    4.  Is there any way to give service access permission to role specific user group? 

    Please reply to the earliest

    Thanks,

    Vinod


    Thursday, September 5, 2013 4:44 AM

Answers

  • 1. In case of your service is chargeable , you can maintain a database table to log , number of times user logged in or accessed.(using authentication)

    2. we have a instance management concept in WCF . Instance management contains 3 types of creation of service instances.

       i) Per call ii) per session iii) single instance mode.
      if we really want to maintain the session state for current service , we have use 'per session' service berhaviour'

    3.WCF service is secured in many ways . with type of binding we use , transportation , message security and also by certificates to identify the identity of client.
    4. by providing the roles we can access or prevent the access to specific users.

    Thank,

    satyakrishna  


    Thursday, September 5, 2013 10:01 AM
  • Hi,
    >>1. See, my hosted service is chargeable and I want to track the record that who has called/ accessed my service how many time, how can I do it?

    The solution provided by @satay will help you.

    >>2.How session management is done in WCF ? 

    In WCF, sessions are explicitly defined and closed  from client side applications, unlike ASP.NET applications where  sessions are server initiated. There are two kinds of sessions in WCF:  Reliable session which is responsible for transactions, and the other  type keeps session values for objects.
    We choose endpoint bindings which support session. For example, BasicHttpBinding does not support sessions. To start, the ServiceContract attribute's SessionMode property is set. It can be:
    • SessionMode.Required: Session is required to be implemented.
    • SessionMode.Allowed: Session is allowed to be implemented.
    • SessionMode.NotAllowed: Session implementation is not allowed. It will not keep the session values.
    By default, it is set to Allowed, so we do not need to set it to Allowed.
    The service behavior can be set to InstanceContextMode.PerSession, InstanceContextMode.PerCall, InstanceContextMode.Single. InstanceContextMode is used to define the number of instances for each call.
    • Persession sets a new instance for each session.
    • PerCall sets a new instance for each call even for a single user.
    • Single sets an instance for all calls from all clients. It acts as a singleton; if an instance does not exist, it is created.


    >>3. How WCF service is secured?

    In wcf there are two major security modes are transport mode and message mode. The security mode determines how messages are secured and how to security the transport.

    For more information, please try to refer to:

    #Securing Services:
    http://msdn.microsoft.com/en-us/library/ms734769.aspx .

    #Message and Transport Security:
    http://msdn.microsoft.com/en-us/library/ff648863.aspx .

    >>4.  Is there any way to give service access permission to role specific user group?

    Yes, it is possible.
    I think the WCF Role-Based Authorization will meet your reqiurement.

    For more information, please try to refer to:
    #WCF Role-Based Authorization:
    http://msdn.microsoft.com/en-us/magazine/cc948343.aspx .

    Best Regards,
    Amy Peng


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Friday, September 6, 2013 3:06 AM
    Moderator

All replies

  • 1. In case of your service is chargeable , you can maintain a database table to log , number of times user logged in or accessed.(using authentication)

    2. we have a instance management concept in WCF . Instance management contains 3 types of creation of service instances.

       i) Per call ii) per session iii) single instance mode.
      if we really want to maintain the session state for current service , we have use 'per session' service berhaviour'

    3.WCF service is secured in many ways . with type of binding we use , transportation , message security and also by certificates to identify the identity of client.
    4. by providing the roles we can access or prevent the access to specific users.

    Thank,

    satyakrishna  


    Thursday, September 5, 2013 10:01 AM
  • Hi,
    >>1. See, my hosted service is chargeable and I want to track the record that who has called/ accessed my service how many time, how can I do it?

    The solution provided by @satay will help you.

    >>2.How session management is done in WCF ? 

    In WCF, sessions are explicitly defined and closed  from client side applications, unlike ASP.NET applications where  sessions are server initiated. There are two kinds of sessions in WCF:  Reliable session which is responsible for transactions, and the other  type keeps session values for objects.
    We choose endpoint bindings which support session. For example, BasicHttpBinding does not support sessions. To start, the ServiceContract attribute's SessionMode property is set. It can be:
    • SessionMode.Required: Session is required to be implemented.
    • SessionMode.Allowed: Session is allowed to be implemented.
    • SessionMode.NotAllowed: Session implementation is not allowed. It will not keep the session values.
    By default, it is set to Allowed, so we do not need to set it to Allowed.
    The service behavior can be set to InstanceContextMode.PerSession, InstanceContextMode.PerCall, InstanceContextMode.Single. InstanceContextMode is used to define the number of instances for each call.
    • Persession sets a new instance for each session.
    • PerCall sets a new instance for each call even for a single user.
    • Single sets an instance for all calls from all clients. It acts as a singleton; if an instance does not exist, it is created.


    >>3. How WCF service is secured?

    In wcf there are two major security modes are transport mode and message mode. The security mode determines how messages are secured and how to security the transport.

    For more information, please try to refer to:

    #Securing Services:
    http://msdn.microsoft.com/en-us/library/ms734769.aspx .

    #Message and Transport Security:
    http://msdn.microsoft.com/en-us/library/ff648863.aspx .

    >>4.  Is there any way to give service access permission to role specific user group?

    Yes, it is possible.
    I think the WCF Role-Based Authorization will meet your reqiurement.

    For more information, please try to refer to:
    #WCF Role-Based Authorization:
    http://msdn.microsoft.com/en-us/magazine/cc948343.aspx .

    Best Regards,
    Amy Peng


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Friday, September 6, 2013 3:06 AM
    Moderator