银光->WCF ->数据库 ->问题 [英] Silverlight -> WCF -> Database -> problem
问题描述
我有一些调用 WCF 服务的 Silverlight 代码,然后该服务使用实体框架访问数据库并返回记录.
I have some silverlight code that calls a WCF service which then uses the Entity Framework to access the database and return records.
一切正常,但是......当我用经典的 ADO.NET 代码替换实体框架代码时,我收到一个错误:
Everything runs fine but ... when I replace the Entity Framework code with classic ADO.NET code I get an error:
远程服务器返回错误:NotFound
The remote server returned an error: NotFound
当我使用单元测试直接调用 ADO.NET 代码时,它返回的记录正常,因此 ADO.NET 代码没有问题
When I call the ADO.NET code directly with a unit test it returns records fine so it's not a problem with the ADO.NEt code
我使用了 fiddler,它似乎说无法找到该服务并出现500"错误.
I used fiddler and it seems to say that the service cannot be found with a "500" error.
我认为这与服务无关,因为我唯一改变的是访问数据库的技术.
i don't think it's anything to do with the service as the only thing I change is the technology to access the database.
有人知道我在这里遗漏了什么吗?
Anyone know what i'm missing here?
推荐答案
尝试添加
HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
到 Silverlight 应用程序的应用程序启动事件.
to the Application startup event of the Silverlight app.
它应该为您提供真正错误的详细信息,而不是 NotFound.就我而言,我缺少用于跨域请求的 clientaccesspolicy.xml.
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.
这篇关于银光->WCF ->数据库 ->问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!