Silverlight -> WCF -> Database -> problem

前端 未结 4 1553
长情又很酷
长情又很酷 2020-12-22 01:44

I have some silverlight code that calls a WCF service which then uses the Entity Framework to access the database and return records.

Everything runs fine but ... wh

相关标签:
4条回答
  • 2020-12-22 02:06

    'NotFound' is a generic error message that could mean just about anything. If you are absolutely positive that you haven't changed the service interface, then the likely candidate is an exception is being thrown from within your service. Are you sure that the collection type that contains the data you are trying to return hasn't changed, i.e. from List< OfSomthing> to List< OfSomethingElse>?

    In any case, something i have found invaluable for tracking this sort of issue is the Service Trace Viewer tool from Microsoft. Read all about it right here, all it takes is some simple changes to your web.config to enable the logging.

    0 讨论(0)
  • 2020-12-22 02:18

    try to add

    HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
    

    to the Application startup event of the Silverlight app.

    It should give you detail of what the real error is rather than NotFound. In my case, i was missing the clientaccesspolicy.xml resuired for cross domain requests.

    How to: Specify Browser or Client HTTP Handling

    0 讨论(0)
  • 2020-12-22 02:25

    John Papa has a great article from MSDN Magazine Data Performance and Fault Strategies in Silverlight 3 that explains this issue and offers a solution. Due to browser limitations, error code 500s aren't routed properly. His solution modifies the outgoing HttpResponse Message back to a 200 for all Silverlight 500 responses.

    0 讨论(0)
  • 2020-12-22 02:30

    If you are still stuck, you may want to try making the call to the service from the machine hosting the service. IIS by default returns much more information about what might have gone wrong when the call is from the local machine. (I believe this can be changed, but don't know for sure.)

    0 讨论(0)
提交回复
热议问题