【问题标题】:Error while using Microsoft Translator API from console app从控制台应用程序使用 Microsoft Translator API 时出错
【发布时间】:2013-09-01 18:38:56
【问题描述】:

我正在尝试通过使用他们公开的 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.HandleReply(ProxyOperationRunt ime 操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, eway 上的布尔值,ProxyOperationRuntime 操作,Object[] ins, Object[] 出局,TimeSpan 出局)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall 消息方法调用,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)

在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 ConsoleApplication1.ServiceReference1.LanguageService.Detect(字符串 appId,字符串文本)在 ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(字符串 C:\Users\lh95\documents\visual studio 中的 appId,字符串文本) 2010\项目\控制台应用程序1\控制台应用程序1\服务 References\ServiceReference1\Reference e.cs:line 69 at ConsoleApplication1.Program.Main(String[] args) 在 C:\Users\lh95\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:行 25

未处理的异常:System.ServiceModel.FaultException:IP 不能 临时访问服务

服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime 操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, eway 上的布尔值,ProxyOperationRuntime 操作,Object[] ins, Object[] 出局,TimeSpan 出局)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall 消息方法调用,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)

在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 ConsoleApplication1.ServiceReference1.LanguageService.Detect(字符串 appId,字符串文本)在 ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(字符串 C:\Users\lh95\documents\visual studio 中的 appId,字符串文本) 2010\项目\控制台应用程序1\控制台应用程序1\服务 References\ServiceReference1\Reference e.cs:line 69 at ConsoleApplication1.Program.Main(String[] args) 在 C:\Users\lh95\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:行 33

【问题讨论】:

    标签: c# wcf console-application microsoft-translator


    【解决方案1】:

    那是服务器返回的消息(嗯,异常);您需要检查文档以了解它拒绝服务请求的任何情况。您可能会被暂时禁止访问该服务,例如,如果您在很短的时间内提出了太多请求或类似的事情 - 这就是我的感觉。或者他们以某种方式认为您一直在尝试违反他们的服务条款。

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      相关资源
      最近更新 更多