I have method called SColl. This method invokes a webservice.
When using parallel.invoke I am getting a 403 (Forbidden Access) error. Sometimes in 1 or 2, like d1, d3, d4 returned records, but d2 and d5 returned forbidden access.
Parallel.Invoke(
() =>
{
List<myclass> d1 = SColl(param, param, param, param);
},
() =>
{
List<myclass> d2 = SColl(param, param, param, param);
},
() =>
{
List<myclass> d3 = SColl(param, param, param, param);
},
() =>
{
List<myclass> d4 = SColl(param, param, param, param);
},
() =>
{
List<myclass> d5 = SColl(param, param, param, param);
});
public List<myclass> SColl(param, param, param, param)
{
// fill param to pass to web service call
// ab = webservice is invoked
// for loop fill data from webservice to list
// return list
}
But if I do sequential calls, all the lists returns data. What is wrong with the service or at my end? Or is something related to machine? I am debugging this code in P4 single core with WinXP.
List<myclass> d1 = SColl(param, param, param, param);
List<myclass> d2 = SColl(param, param, param, param);
List<myclass> d3 = SColl(param, param, param, param);
List<myclass> d4 = SColl(param, param, param, param);
List<myclass> d5 = SColl(param, param, param, param);
Try turning off keep-alives in IIS for your web service. This should help a bit. Remember , that IIS on Win XP has a limit of incoming connections, so you’re basically launching DoS attack on yourself 😉