我试图通过使用它们公开的SOAP服务来使用Microsoft Translator API http://api.microsofttranslator.com/V1/SOAP.svc ,在控制台应用中添加服务参考,并尝试调用检测方法,但失败时出现以下错误
ServiceReference1.LanguageServiceClient client = new LanguageServiceClient();
string detect = client.Detect("", "Hello");
Console.WriteLine("Detected language "+detect.ToString());
Console.ReadKey();
System.ServiceModel.FaultException:IP无法访问该服务 暂时
服务器堆栈跟踪:at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime操作,ProxyRpc& rpc)at System.ServiceModel.Channels.ServiceChannel.Call(String action, eway上的布尔值,ProxyOperationRuntime操作,Object [] ins, 对象[]出局,TimeSpan时间表) System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall 消息methodCall,ProxyOperationRuntime操作)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天 消息)
在[0]处重新抛出异常:at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天 req Msg,IMessage retMsg)at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; msgDa ta,Int32 type)at ConsoleApplication1.ServiceReference1.LanguageService.Detect(字符串 appId,String text)at ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(字符串 在C:\ Users \ lh95 \ documents \ visual studio中的appId,String text) 2010 \ Projects \ Conso leApplication1 \ ConsoleApplication1 \ Service 参考文献\ ServiceReference1 \ Referenc e.cs:第69行 ConsoleApplication1.Program.Main(String [] args)in C:\ Users \ lh95 \ documents \ visual studio 2010 \ Projects \ ConsoleApplication1 \ ConsoleApplication1 \ Program.cs:line 25
未处理的异常:System.ServiceModel.FaultException:IP不能 暂时访问服务
服务器堆栈跟踪:at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime操作,ProxyRpc& rpc)at System.ServiceModel.Channels.ServiceChannel.Call(String action, eway上的布尔值,ProxyOperationRuntime操作,Object [] ins, 对象[]出局,TimeSpan时间表) System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall 消息methodCall,ProxyOperationRuntime操作)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天 消息)
在[0]处重新抛出异常:at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天 req Msg,IMessage retMsg)at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; msgDa ta,Int32 type)at ConsoleApplication1.ServiceReference1.LanguageService.Detect(字符串 appId,String text)at ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(字符串 在C:\ Users \ lh95 \ documents \ visual studio中的appId,String text) 2010 \ Projects \ Conso leApplication1 \ ConsoleApplication1 \ Service 参考文献\ ServiceReference1 \ Referenc e.cs:第69行 ConsoleApplication1.Program.Main(String [] args)in C:\ Users \ lh95 \ documents \ visual studio 2010 \ Projects \ ConsoleApplication1 \ ConsoleApplication1 \ Program.cs:line 33
答案 0 :(得分:0)
这是服务器返回的消息(例如,异常);您需要查看文档以了解拒绝提供请求的任何情况。您可能暂时不允许访问该服务,例如,如果您在非常短的时间内提出了太多请求或类似的东西 - 这听起来对我来说就是这样。或者他们认为你一直在试图违背他们的服务条款。