簡體   English   中英

從控制台應用程序使用Microsoft Translator API時出錯

[英]Error while using Microsoft Translator API from console app

我正在嘗試通過使用由他們公開的SOAP服務使用Microsoft Translator API http://api.microsofttranslator.com/V1/SOAP.svc ,通過在控制台應用程序中添加服務引用,並嘗試調用Detect方法,但操作失敗以下錯誤

ServiceReference1.LanguageServiceClient client = new LanguageServiceClient();
                string detect = client.Detect("", "Hello");
                Console.WriteLine("Detected language "+detect.ToString());
                Console.ReadKey();

System.ServiceModel.FaultException:IP無法臨時訪問服務

服務器堆棧跟蹤:位於System.ServiceModel.Channels.ServiceChannel.Call(位於System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime操作,ProxyRpc&rpc)(字符串操作,eway上的布爾值,ProxyOperationRuntime操作,Object [] ins,Object [ ] outs,在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall消息methodCall,ProxyOperationRuntime操作)在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

在[0]處拋出異常:在ConsoleApplication1處,System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgDa ta,Int32類型)在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage請求Msg,IMessage retMsg)處重新引發了異常。在C:\\ Users \\ lh95 \\ documents \\ visual studio 2010 \\ Projects \\ Conso leApplication1 \\ ConsoleApplication1 \\ Service References中的ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId,String text)處的ServiceReference1.LanguageService.Detect(String appId,String text) \\ ServiceReference1 \\ Referenc e.cs:C:\\ Users \\ lh95 \\ documents \\ visual studio 2010 \\ Projects \\ ConsoleApplication1 \\ ConsoleApplication1 \\ Program.cs中的ConsoleApplication1.Program.Main(String [] args)處的Line69

未處理的異常:System.ServiceModel.FaultException:IP無法臨時訪問服務

服務器堆棧跟蹤:位於System.ServiceModel.Channels.ServiceChannel.Call(位於System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime操作,ProxyRpc&rpc)(字符串操作,eway上的布爾值,ProxyOperationRuntime操作,Object [] ins,Object [ ] outs,在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall消息methodCall,ProxyOperationRuntime操作)在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

在[0]處拋出異常:在ConsoleApplication1處,System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgDa ta,Int32類型)在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage請求Msg,IMessage retMsg)處重新引發了異常。在C:\\ Users \\ lh95 \\ documents \\ visual studio 2010 \\ Projects \\ Conso leApplication1 \\ ConsoleApplication1 \\ Service References中的ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId,String text)處的ServiceReference1.LanguageService.Detect(String appId,String text) \\ ServiceReference1 \\ Referenc e.cs:C:\\ Users \\ lh95 \\ documents \\ visual studio 2010 \\ Projects \\ ConsoleApplication1 \\ ConsoleApplication1 \\ Program.cs中的ConsoleApplication1.Program.Main(String [] args)處的Line69

那是服務器返回的消息(當然,是異常)。 您需要檢查文檔中是否有可能拒絕處理請求的情況。 例如,如果您在很短的時間間隔內發出了太多請求或類似的請求,則可能會暫時禁止您訪問該服務-這對我來說就是這樣。 或者他們以某種方式認為您一直在嘗試違反他們的服務條款。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM