无法计算表达式,因为代码已优化或本机帧位于调用堆栈之上

时间:2013-10-24 15:47:58

标签: .net multithreading httpwebrequest

我对此有点打击,我有多个线程提出网页请求的片段代码

 var request = (HttpWebRequest)WebRequest.Create(uri) as HttpWebRequest;
                    request.Accept = "application/xml";
                    request.Method = shopfiyRequest.ActionType.ToString();
                    if (string.IsNullOrEmpty(shopfiyRequest.ContentType))
                        request.ContentType = shopfiyRequest.ContentType;

                    // authentication
                    var cache = new CredentialCache();
                    cache.Add(uri, "Basic", new NetworkCredential(apiKey, password));
                    request.Credentials = cache;

                    ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);


HttpWebResponse response = null;

                        Log.Debug("Getting responsce from shopify");
                        // This is where the HTTP GET actually occurs.
                        response = (HttpWebResponse)request.GetResponse();

一旦线程点击行response = (HttpWebResponse)request.GetResponse();,它就会抛出异常

无法评估表达式,因为代码已优化或本机框架位于调用堆栈之上。

I have tried catching and ignoring abort exception,但似乎无济于事

任何帮助或内部的帮助都是值得的。

0 个答案:

没有答案