tags:

views:

33

answers:

2

Hi i use wshttpbinding in my service Config and message security. my app works fine but after 10 or 20 min when client call any method of service, an exception throw cuz my security token will be expired, and connection cant be work.

one solution is re_create connection to make new token (but i cant use this cuz my service contain datacontext and if i re_create service, datacontext will be new)

other solution is change security type from message to transport (i try this solution but nothing change cuz other exception throw)

A: 

I am assuming that when you say datacontext you mean Enitity Framework datacontext.

Your solution appears to depend on the datacontext being available when the client returns. This is a very brittle approach. Even if you increased all the relevant timeouts, you would still get errors if for example the server restarted.

Take a look at WCF Data Services http://msdn.microsoft.com/en-us/data/bb931106.aspx

Shiraz Bhaiji
A: 

Best Solution is Make re-create your connection in each calling service method. But in my position I cant use that cuz our Framework provide Special problem. Even with my Special problem I use that solution With Special Trick.;)

I made a method return true.and I call It 10 min after last call.This make Service Token never Expired until Application closed. And for last use Try-Catch and handle Exception throw by Service.

With Special Thank from "Shiraz Bhaiji"

Rev