调用情感 API 后抛出 TargetInitationException
我们正在开发 Silverlight Web 应用程序,以在地图上显示推文并使用情绪 API 分析推文。我们使用情感 API 3 或 4 周没有出现任何问题。以前,我们有时在调用情感API后会遇到TargetInitationException
现在,我们越来越多地在调用情感API后遇到TargetInitationException。
XDocument newdoc = XDocument.Parse(en.Result);
en.Result 变为 null 并
显示异常:
System.Reflection.TargetInvocatinException :操作过程中发生异常,导致结果无效。检查 InnerExceptionon 以获取异常详细信息。 ---> System.Net.WebException:远程服务器返回错误:NotFound ---> System.Net.WebException:远程服务器返回错误:NotFound。 在 System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult ayncResult) 在 System.Net.Browser.BrowserHttpWebRequest.<>c_DisplalyClass4.b__1(Object sendState) ---内部异常堆栈跟踪结束 在 System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,对象状态) 在 System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult ayncResult) 在 System.Net.WebClient.GetWebResponse(WebRequest,IAsyncResult 结果) 在 System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult 结果) ---内部异常堆栈跟踪结束 在 System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 在 System.Net.DownloadStringCompletedEvent Args.get_Result() 在 SilverlightApplication1.MainPage。<>c_DisplayClass1a。<>c_DisplayClass23.b__16(Object ss,DownloadStringCompletedEventArgs en)
We are developing Silverlight web application to display the tweets on the map and analyse the tweets by using sentiment API. we used sentiment API without problems for 3 or 4 weeks. Then, we sometimes faced TargetInvocationException after calling sentiment API
Now, we face TargetInvocationException after calling sentiment API more and more.
XDocument newdoc = XDocument.Parse(en.Result);
en.Result become null and
the exception is shown :
System.Reflection.TargetInvocatinException : An exception occurred during the operation, making the result invalid. Check InnerExcepton for exception details. --->
System.Net.WebException: The remote server returned an error: NotFound ---> System.Net.WebException : The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult ayncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplalyClass4.b__1(Object sendState)
---End of inner exception stack trace
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult ayncResult)
at System.Net.WebClient.GetWebResponse(WebRequest, IAsyncResult result)
at System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
---End of inner exception stack trace
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at System.Net.DownloadStringCompletedEvent Args.get_Result()
at SilverlightApplication1.MainPage.<>c_DisplayClass1a.<>c_DisplayClass23.b__16(Object ss, DownloadStringCompletedEventArgs en)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我有一个具有 Enum 类型属性的数据协定类时,我遇到了这个异常。然后我用 [KnownType (typeof(MyEnum))] 装饰 DataContract。之后我没有看到这个异常。
I faced this exception when I had a data contract class which had a property of type Enum. Then I decorated the DataContract with [KnownType (typeof(MyEnum))]. I did not see this exception after that.