0
votes

My wcf service operation contract runs a code to initialize the database connection to fetch data. Database initialization does take some time resulting in low performance . Is there something i can do with my WCF service to overcome this situation. With my desktop application, the connection was required to be set only once and hence it was not much of a problem.

ServiceBehaviour is currently set as instanceContextMode=InstanceContextMode.PerCall and ConcurrencyMode = ConcurrencyMode.Multiple

Should I be using a persession context mode or any stateful behaviour. No ideas if there is something i can work upon instead of relying on database team to rectify the initialization problems ?

1

1 Answers

0
votes

You can use a pool of connections to avoid the handshake and new connection on each request. Here, some document about SQL-Server: https://msdn.microsoft.com/en-us/library/8xx3tyca.aspx

You could also use a singleton behavior or even a static connection, but these two last options are not the best choices.