Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All experts,

I am a bit new to WCF. I had explicit requirement to prepare a wcf application with below requiements,

1. Need to prepare synchronous WCF service hosted in IIS
2. Client will consume synchronous WCF service.
3. request & response might take long time, as other applications are involved in this process.
4. Need to maintain the state during this long request & response process.
5. Should not use any Workflows


So basically, I need to maintain state without lossing/deadlocks during the long synchronous request<->response process.

Please share your valuable suggestion.

Regards
balu
Posted

1 solution

Yeah, requirements like this comes in case of Services which depend on multiple resources.

I'd suggest you the following points, implementing which you could achieve your desired result:
1-In ServiceContract use the following SessionMode attribute:
C#
[ServiceContract(SessionMode=SessionMode.Required)]

2-In ServiceBehaviour use PerSession attribute as following:
C#
[ServiceBehaviour(InstanceContextMode=InstanceContextMode.PerSession)]

3-And since you are saying that multiple applications are involved in this Service, so use Reentrant property of Concurrency in ServiceBehaviour as following:
C#
[ServiceBehaviour(ConcurrencyMode=ConcurrencyMode.Reentrant)]

This will help you to avoid any kind of DeadLock.

I'm sure if you could use the above properties efficiently then you would surely achieve your desired goal.

Regards,
Gittu
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900