我需要使用Visual和C#调用web服务。我已经创建了一个配置文件和一个客户端来调用该服务,但是我一直得到一个异常:
System.ServiceModel.FaultException'1: Oracle连接失败。
由于我没有真正使用过ASP.NET应用程序和web服务,所以我不确定如何解决这个问题,以及它是由于我的错误还是由于创建的web服务本身有问题。
我曾使用以下电话服务:
ServiceReference.InformationClient client = new ServiceReference.InformationClient();
client.GetInformation("123");
client.close();GetInformation是Web,具有字符串类型的输入参数ID,并返回用户名、姓氏和年龄的数据集。
这是堆栈跟踪:
System.ServiceModel.FaultException`1 was unhandled
Message=Oracle Connection is not successful
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ConsumingWebService.ServiceReference.IInformation.GetInformation(String ID)
at ConsumingWebService.ServiceReference.InformationClient.GetInformation(String ID) in c:\users\user\documents\visual studio 2010\Projects\ConsumingWebService\ConsumingWebService\Service References\ServiceReference\Reference.cs:line 53
at ConsumingWebService.Program.Main(String[] args) in c:\users\user\documents\visual studio 2010\Projects\ConsumingWebService\ConsumingWebService\Program.cs:line 13
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()发布于 2015-07-19 14:24:00
https://stackoverflow.com/questions/31502083
复制相似问题