I have a wcf méthode like this :
[ServiceContract]
public interface IMyService
{
[OperationContract]
[WebInvoke(UriTemplate = "UpdateMyData", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
[return: MessageParameter(Name = "updateMyDataResponse")]
UpdateMyDataResponse UpdateMyData(UpdateMyDataRequest updateMyDataRequest);
}
public class MyService : IMyService
{
//1. i want this methode not callable with the same data in the request
//2. or i want it callable only once at a time by the client
//means the client must wait the end of the first request to send the seconde
//3. or i want the client to be able to call the entire service request by request
public UpdateMyDataResponse
UpdateMyData(UpdateMyDataRequest updateMyDataRequest)
{
var fileName = updateMyDataRequest.fileName;
//Never Go her with the same filename value for all the service's insatnces
//or never go her for the same client twice in the same time
//Heavy work
//...
return new UpdateMyDataResponse(true);
}
}
i have found tow possible solutions.
1. Use service instance per session, and limit the connections of the client to 1
This issue is a security one. that means the calls for the data of the same client can comme from multiple IP. And i'm not sur i can make my boss accept this solution
2. Use static list in the service class, and store the file names in process.
This solution is apparently a bad practice. And i'm not sure i'm going to convince, either.
can anyone give me an advice or a link ?