Author: sindrej | Posted on: 6/25/2010 8:20:43 AM | Views : 292

So I have a WebMethod that I call using jQuery. The method is supposed to return a unique URL to a image file created dynamicly.
The WebMethod is called in a for loop so anywhere from 1 to 50 calls gets fired async.
The problem is that the webservice seems to be using the same instance of the object, so that it returns the same value to a couple of the requests.


[WebMethod] public PlotterImage PlotterPreview(string font, int pointSize, string text, string colour) { PlotterAccess prev = new PlotterAccess(); return prev.Preview(font, pointSize, text, colour); }
Shouldn't the WebMethod create a new instance of the class for each call, so that all values are stored individually in memory?



public PlotterImage Preview(string font, int size, string text, string colour) { }


...

Go to the complete details ...