Silverlight-> WCF->数据库->问题 [英] Silverlight -> WCF -> Database -> problem

查看:77
本文介绍了Silverlight-> WCF->数据库->问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些调用WCF服务的Silverlight代码,然后该服务使用Entity Framework访问数据库并返回记录。

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代码替换了Entity Framework代码,我得到一个错误:

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

我用了提琴手,似乎说找不到带有 500错误的服务。

I used fiddler and it seems to say that the service cannot be found with a "500" error.

i不要以为与服务无关,因为我唯一改变的就是访问数据库的技术。

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.

如何:指定浏览器或客户端HTTP处理

这篇关于Silverlight-> WCF->数据库->问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆