调用WCF服务时部署Silverlight应用程序异常

时间:2010-03-25 22:25:35

标签: c# silverlight wcf deployment

Silverlight应用程序运行但是当它调用我得到的服务时:

操作期间发生异常,导致结果无效。检查InnerException以获取异常详细信息。    在System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()    at SalesSimplicityPO_SL.POSvc.GetPurchaseOrdersCompletedEventArgs.get_Result()    at SalesSimplicityPO_SL.About.mySvc_GetPurchaseOrdersCompleted(Object sender,GetPurchaseOrdersCompletedEventArgs e)    at SalesSimplicityPO_SL.POSvc.POSvcClient.OnGetPurchaseOrdersCompleted(Object state)

我加载并调用我的网络服务,如..

    BasicHttpBinding binding = new BasicHttpBinding();
    EndpointAddress address = new EndpointAddress(new Uri("http://localhost/POSystem/POSvc.svc"));
    POSvc.POSvcClient mySvc = new POSvc.POSvcClient(binding, address); 
    mySvc.InsertPOCompleted += new EventHandler<SalesSimplicityPO_SL.POSvc.InsertPOCompletedEventArgs>(mySvc_InsertPOCompleted);
    mySvc.InsertPOAsync(InitialsTextBox.Text.ToString(), DescTextBox.Text.ToString(), ClientTextBox.Text.ToString());

在调试方面效果很好....

我错误地得到了这个错误?


更新

我真的不明白为什么它修好了但是修好了..也许有人可以提供一些信息......

我改变了

EndpointAddress address = new EndpointAddress(new Uri("http://localhost/POSystem/POSvc.svc"));  

TO

 EndpointAddress address = new EndpointAddress(new Uri(Application.Current.Host.Source, "../POSvc.svc")); 

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

我真的不明白为什么它修好了但是修好了..也许有人可以提供一些信息......

我改变了

EndpointAddress address = new EndpointAddress(new Uri("http://localhost/POSystem/POSvc.svc"));  

TO

 EndpointAddress address = new EndpointAddress(new Uri(Application.Current.Host.Source, "../POSvc.svc"));