سؤال

I'm using a recursive function in IIS. It uses the following code:

void recursivefunction(int value)
{
Random random=new Random();
int randomValue=random.Next(1,1000000);
if(randomValue!=value)
recursivefunction(value);
else
return randomValue;
}

This function throws "StackOverflowException" when I run the mvc program in IIS. I know that it happens because the size of call stack size exceeds its limit.

Is there any way to increase the call stack size so my program will not throw this exception frequently?

This exception was thrown mostly when I run the program in IIS.

هل كانت مفيدة؟

المحلول

You are asking for sticky sessions, which does not exist today in Azure. You can implement it yourself using IIS's ARR, but ultimately this is not a good approach for a scalable, stateless, fault tolerant service. A better approach would be to put the image in a common repository where all of the instances can reach it, such as blob storage. Or even better, put the image in blob storage and serve it directly to the client from blob storage rather than through one of the role instances.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top