Let's create our first web service in the cloud. The service will return the factorial of a number. Just like our Hello World ASP.NET application, we will create a new Cloud Service project but this time with no Role. Once the project is created, create a new ASP.NET Web Service Application project and add it as a Web Role in the Cloud Service project. Just add the following methods to it. [WebMethod]
public double GetFactorial(int x)
{
double factorial = 0;
if (x >= 0)
{
factorial = CalcFactorial(x);
} return factorial;
}privat static double CalcFactorial (int x)
{
// base case
if (x <= 1)
{
return 1;
} return x * CalcFactorial (x -1);
} Now, press F5 and you will get the following.Read more: Sajid's TechnoTips
public double GetFactorial(int x)
{
double factorial = 0;
if (x >= 0)
{
factorial = CalcFactorial(x);
} return factorial;
}privat static double CalcFactorial (int x)
{
// base case
if (x <= 1)
{
return 1;
} return x * CalcFactorial (x -1);
} Now, press F5 and you will get the following.Read more: Sajid's TechnoTips