未处理的类型' System.StackOverflowException'发生在mscorlib.dll中

时间:2014-05-21 07:25:26

标签: web-services asp.net-mvc-4

我有一个调用外部Web服务的MVC 4应用程序。我将Web服务添加为Web引用(WipoSvc)。我创建了一个类,它调用Web服务并使用其方法来收集数据。

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;

我从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();
    }

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

        GetIasrFromWS iasr = new GetIasrFromWS();
        iasr.GetIasrData(txtAppNo);

我在创建Web服务实例时收到以下错误消息。

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.}

我在班上的以下一行收到错误。

PatentScopeService ws = new PatentScopeService();

PatentScopeService的构造函数是:

public PatentScopeService() {
    this.Url = global::WipoExtract.Properties.Settings.Default.WipoExtract_WipoSvc_PatentScopeS‌​ervice;
    if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
        this.UseDefaultCredentials = true;
        this.useDefaultCredentialsSetExplicitly = false;
    } else {
        this.useDefaultCredentialsSetExplicitly = true;
    }
} 

任何帮助都将不胜感激。

0 个答案:

没有答案