在调试应用程序时,我收到以下错误.
CLR无法从COM上下文0x3b2d70过渡到COM上下文0x3b2ee0 60秒.拥有目标上下文/公寓的线程很可能是在非抽空等待或处理非常长时间运行的操作而不抽取Windows消息.这种情况通常会对性能产生负面影响,甚至可能导致应用程序变得无响应或内存使用量随时间不断累积.为了避免这个问题,所有单线程单元(STA)线程都应该使用抽取等待原语(例如CoWaitForMultipleHandles)并在长时间运行操作期间定期泵送消息.
为什么系统会抛出此错误.
I've written following code to get the content from a web page and save to the system. if the webpage is in html format i'm able to save it. if the web page is in pdf format i'm unable to save it. After saving if i opend the file blank pages are coming.
我想知道如何从响应中保存pdf文件.
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
webContent = reader.ReadToEnd();
StreamWriter sw = new StreamWriter(FileName);
sw.WriteLine(webContent); …Run Code Online (Sandbox Code Playgroud) c# ×3