首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Visual 10和C#使用web服务

使用Visual 10和C#使用web服务
EN

Stack Overflow用户
提问于 2015-07-19 14:08:42
回答 1查看 275关注 0票数 0

我需要使用Visual和C#调用web服务。我已经创建了一个配置文件和一个客户端来调用该服务,但是我一直得到一个异常:

System.ServiceModel.FaultException'1: Oracle连接失败。

由于我没有真正使用过ASP.NET应用程序和web服务,所以我不确定如何解决这个问题,以及它是由于我的错误还是由于创建的web服务本身有问题。

我曾使用以下电话服务:

代码语言:javascript
复制
ServiceReference.InformationClient client = new ServiceReference.InformationClient();
client.GetInformation("123");
client.close();

GetInformation是Web,具有字符串类型的输入参数ID,并返回用户名、姓氏和年龄的数据集。

这是堆栈跟踪:

代码语言:javascript
复制
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()
EN

回答 1

Stack Overflow用户

发布于 2015-07-19 14:24:00

FaultException

WCF世界中的FaultExceptions被用作在WCF通道之间通信服务器错误/异常的方法。

在您的示例中,您试图使用的web服务似乎在连接到所需数据库时遇到问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31502083

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档