ASP.NET web service- restrict some concurrent instances based on validation -
I have an ASP.NET Web service running on a web server that is one of the web processing methods (WM) Whatever the processing is based on the parameter (param)
I only want to restrict the concurrent calls to this web method in some cases - that is, when the value of the supreme value passed by client 1 is equal to the maximum passed by client 2.
I was thinking of adding some assumptions at the beginning of the wm to check the situations before the process began.
My questions are:
- How can I find out from within my web method, if the same web method is being executed then the web service There is another example.
- How can I access all the parameters near my webmath when they are running, then they are webservice.
I want to avoid database logging because when the server log goes down, it can not be updated (unless there is no good way to deal with this possibility)
IMHO web services should require stay stateless and avoid such things needed. Otherwise by the tip of my head (not tested):
[WebMethod] Public Zero Certain Methods (String P) {var cache = HttpContext.Current.Cache; // Be careful with the comparison of similarities here // if it can not work with complex type (cache ["param"] == p) {throw a new exception ("Other clients have used this method with the same logic Is said "); } Cash ["param"] = p; Try {// your method here}} Finally {Cash. Remove ("Ultimate"); }}
Comments
Post a Comment