我试图通过使用他们公开的 SOAP 服务 http://api.microsofttranslator.com/V1/SOAP.svc来使用 Microsoft Translator API ,通过在控制台应用程序中添加服务引用并尝试调用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 时间操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[ ] outs, TimeSpan time eout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall Message methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
在 [0] 处重新引发异常:在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 ConsoleApplication1 处的 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg)。 ServiceReference1.LanguageService.Detect(String appId, String text) 在 C:\Users\lh95\documents\visual studio 2010\Projects\Conso leApplication1\ConsoleApplication1\Service 中的 ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId, String text) \ServiceReference1\Reference e.cs:C:\Users\lh95\documents \visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 中 ConsoleApplication1.Program.Main(String[] args) 的第 69 行:第 25 行
未处理的异常:System.ServiceModel.FaultException:IP 暂时无法访问服务
服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt 时间操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[ ] outs, TimeSpan time eout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall Message methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
在 [0] 处重新引发异常:在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 ConsoleApplication1 处的 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg)。 ServiceReference1.LanguageService.Detect(String appId, String text) 在 C:\Users\lh95\documents\visual studio 2010\Projects\Conso leApplication1\ConsoleApplication1\Service 中的 ConsoleApplication1.ServiceReference1.LanguageServiceClient.Detect(String appId, String text) \ServiceReference1\Reference e.cs:C:\Users\lh95\documents \visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 中 ConsoleApplication1.Program.Main(String[] args) 的第 69 行:第 33 行