• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

WCF错误远程服务器返回错误未找到

用户头像
it1352
帮助1

问题说明

在我的网站上,我有一个使用WCF服务的silverlight应用程序。通常,一切正常,但是如果我让页面处于非活动状态一段时间,然后单击其中一个按钮,我会收到以下错误:

System.ServiceModel.CommunicationException:远程服务器返回了错误:未找到

这是我的错误发生的代码(错误发生在方法中的第二行代码中(包含_result =((MyApp.MyAppService .....) ):



On my website, I have a silverlight app that utilizes a WCF service. Normally, everything works fine however if I leave the page inactive for a little while, and then click one of the buttons, I get the following error:
System.ServiceModel.CommunicationException: The remote server returned an error: Not Found
Here's the code where my error's occuring (the error occurs on the 2nd line of code within the method(the line that contains "_result = ((MyApp.MyAppService....." ) :

<br />
public MyApp.MyAppService.AccountSilverlight EndGetAccount(System.IAsyncResult result) <br />
{<br />
object[] _args = new object[0];<br />
MyApp.MyAppService.AccountSilverlight _result = ((MyApp.MyAppService.AccountSilverlight)(base.EndInvoke("GetAccount", _args, result)));<br />
                return _result;<br />
}<br />





知道为什么会这样吗?



谢谢。



Any idea why this may be happening?

Thanks.

正确答案

#1




使用silverlight是一个非常常见的错误,首先出现的错误是Silverlight应用程序显示的任何服务端错误的一般错误。

现在的解决方案,试着找出这个错误的根本原因。
Hi,

With silverlight its a very common error, firstly the error u r getting is a generic error which silverlight application shows for any service side error.
Now the solution, try the find out the root cause of this error.
There are various ways of doing this.
Below is the one which i used for mine:
1) Add the below piece of code to ur config file of the wcf service
<system.diagnostics>
    <sources>
      <source name="System.ServiceModel"

              switchValue="Information, ActivityTracing"

              propagateActivity="true">
        <listeners>
          <add name="traceListener"

              type="System.Diagnostics.XmlWriterTraceListener"

              initializeData= "D:\Sumit.svclog"/>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>





这将生成.svc,分析它将提供的文件你有很多信息。



2)你可以使用外部工具来分析wcf服务调用,比如fiddler。在这种情况下,还尝试分析服务调用



this will generate an .svc, analyse this file it will provide you with a lot of information.

2) U can use external tools for analysing the wcf service calls, such as fiddler. In this case also try to analyse the service calls

将此添加到您的配置文件中



add this into your config file

<system.servicemodel>
    <client>
      <endpoint address="ENDPOINT Address">
        (other stuff)
      </endpoint></client></system.servicemodel>
如果服务和客户端绑定不同,或者在动态绑定的情况下,假设您正在使用
This error may arise if the service and client binding are different or in case of dynamic binding suppose you are creating a service with
wshttpbinding and on client you are using basicHttpBinding as it is default. Then this kind of errror may arise. So please check both the
binding are same or not.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfkhec
系列文章
更多 icon
同类精品
更多 icon
继续加载