WCF这是什么意思?

时间:2012-01-04 08:41:38

标签: c# wcf silverlight-4.0

我有一个所有调用都可以运行的WCF。所有这些都是银光。但是这个人称它无法找到它,但它存在并且它也显示出银光的一面。我被困4小时。有什么想法吗?

这有效:

_client.GetHandSetsCompleted += new EventHandler<GetHandSetsCompletedEventArgs>(_client_GetHandSetsCompleted);
_client.GetMarketsCompleted += new EventHandler<GetMarketsCompletedEventArgs>(_client_GetMarketsCompleted);
_client.GetCountByKeyCompleted += new EventHandler<GetCountByKeyCompletedEventArgs>(_client_GetCountByKeyCompleted);

_client.GetHandSetsAsync();
_client.GetMarketsAsync();

但是一碰到这个:

private void UsrExchangeExportClicked(object sender, ExchangeQuerySetArg e)
    {
        XchangeQuerySet x = new XchangeQuerySet();

        x.End = e.End;
        x.Start = e.Start;
        x.Handset = e.Handset;

        //x.Markets = new ObservableCollection<int>(e.Markets);

        _client.GetCountByKeyAsync(x);

    }

它抛出错误。毫无意义。

System.ServiceModel.CommunicationException was unhandled by user code
Message=The remote server returned an error: NotFound.
StackTrace:
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at ExWarranty.XchangeRef.XchangeServiceClient.XchangeServiceClientChannel.EndGetCountByKey(IAsyncResult result)
   at ExWarranty.XchangeRef.XchangeServiceClient.ExWarranty.XchangeRef.IXchangeService.EndGetCountByKey(IAsyncResult result)
   at ExWarranty.XchangeRef.XchangeServiceClient.OnEndGetCountByKey(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Net.WebException
   Message=The remote server returned an error: NotFound.
   StackTrace:
        at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
        at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
        at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   InnerException: System.Net.WebException
        Message=The remote server returned an error: NotFound.
        StackTrace:
             at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
             at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
             at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
        InnerException: 

2 个答案:

答案 0 :(得分:1)

这意味着WCF服务器端可能存在错误。尝试检查活动跟踪或事件日志以获取更多信息。

同时检查可能的重复question

答案 1 :(得分:1)

您是否能够从Fiddler或IE浏览或点击“GetCountByKeyAsync”Web方法。

尝试生成请求并从fiddler点击该方法,看看是否收到了成功响应。如果可行,则通过fiddler检查应用程序的请求,看看是什么导致了问题。

确保传递的对象“XchangeQuerySet”是可序列化的。

另外,要在服务器端获取一些信息,您可以启用跟踪。要启用跟踪,请遵循此link