Error while using Microsoft Translator API from console app

334 Views Asked by At

I am trying to consume Microsoft Translator API by using the SOAP service exposed by them http://api.microsofttranslator.com/V1/SOAP.svc , by adding service reference in a console app and have tried calling Detect method but its failing with the below error

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

System.ServiceModel.FaultException: IP cannot access the service temporarily

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim eout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall Message methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa ta, Int32 type) at ConsoleApplication1.ServiceReference1.LanguageService.Detect(String appId, String text) at ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId, String text) in C:\Users\lh95\documents\visual studio 2010\Projects\Conso leApplication1\ConsoleApplication1\Service References\ServiceReference1\Referenc e.cs:line 69 at ConsoleApplication1.Program.Main(String[] args) in C:\Users\lh95\documents \visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs: line 25

Unhandled Exception: System.ServiceModel.FaultException: IP cannot access the se rvice temporarily

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim eout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall Message methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa ta, Int32 type) at ConsoleApplication1.ServiceReference1.LanguageService.Detect(String appId, String text) at ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId, String text) in C:\Users\lh95\documents\visual studio 2010\Projects\Conso leApplication1\ConsoleApplication1\Service References\ServiceReference1\Referenc e.cs:line 69 at ConsoleApplication1.Program.Main(String[] args) in C:\Users\lh95\documents \visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs: line 33

1

There are 1 best solutions below

0
On

That is a message (well, exception) returned by the server; you'll need to check the documentation for any cases in which it would refuse to serve requests. You may be temporarily disallowed from accessing the service, for example, if you made too many requests in a very short timespan or something similar - that's what it sounds like to me. Or that they somehow think you've been trying to do things against their terms of service.