An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

faniedtfaniedt Johannesburg, South Africa

I have a MVC 4 application that calls an external web service. I add the web service as a web reference (WipoSvc). I created a class which calls the web service and uses on of its methods to gather data.

using WipoExtract.WipoSvc;

namespace WipoExtract
public class GetIasrFromWS
    public string publicationNumber = "";
    public string iaNumber = "";
    public DateTime ifDate;
    public string priCountry = "";
    public string priNumber = "";
    public string priDate = "";
    public string iClassification = "";
    public string title = "";
    public string strAbstract = "";
    public DataTable dtApplicants = new DataTable();
    //public DataTable dtInventors = new DataTable(); 

    public void GetIasrData(string applicationNo)
        PatentScopeService ws = new PatentScopeService();
        ws.PreAuthenticate = true;

I am calling the class from my HomeController.cs.

using System.Web.Mvc;
using WipoExtract.Models;

namespace WipoExtract.Controllers
public class HomeController : Controller
    public ActionResult Index()
        ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

        return View();

    public ActionResult Index(FormCollection formCollection)
        string txtAppNo = formCollection["txtAppNo"];
        @ViewBag.AppNo = txtAppNo;

        GetIasrFromWS iasr = new GetIasrFromWS();

I get the following error message when it creates an instance of the web service.

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
[System.StackOverflowException] {Cannot evaluate expression because the current thread is in a stack overflow state.}

I am getting the error on the following line in my class.

PatentScopeService ws = new PatentScopeService();

Any assistance would be appreciated.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!