第一次尝试wcf数据服务总是从客户端超时
我已阅读所有其他帖子,并且在过去 2 小时内一直在谷歌上搜索此内容!顺便说一句,我大约 3 小时前启动了 WCF 数据服务。
我的服务位于 asp.net4 应用程序上,ado 实体模型公开了 sql server 数据库。
这是 FasDataService.svc.cs
public class FasDataService : DataService<FASStoreEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
config.UseVerboseErrors = true;
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.SetEntitySetAccessRule("*", EntitySetRights.All);
}
}
然后我有一个 winforms 4 应用程序,在 Main() 中包含以下代码
FASStoreEntities fas = new FASStoreEntities(u);
var a = from al in fas.Customers
where al.Name == "Alinio"
select al;
MessageBox.Show(a.First().Phone1);
当我运行 Web 应用程序并指向 http://localhost:15995/FasDataService.svc/Customers(1) 它加载了其中唯一的客户
我的错误是 WebException 未处理:
操作已超时。内部 异常为空。
另外,一切都是本地的,但是当我这样做(在 Chrome 中)时,需要花费大量时间!想想它在生产中的表现会如何,是不是很可怕?
I have read all other posts and have been googling this for the last 2 hours! I started WCF Data Services about 3 hours ago btw.
My service is on an asp.net4 app, the ado entity model exposes an sql server db.
Here is FasDataService.svc.cs
public class FasDataService : DataService<FASStoreEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
config.UseVerboseErrors = true;
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.SetEntitySetAccessRule("*", EntitySetRights.All);
}
}
I have then a winforms 4 app with the following code in the Main()
FASStoreEntities fas = new FASStoreEntities(u);
var a = from al in fas.Customers
where al.Name == "Alinio"
select al;
MessageBox.Show(a.First().Phone1);
When I run the web app and point to http://localhost:15995/FasDataService.svc/Customers(1) it loads up the one and only customer in there
My error is WebException was unhandled:
The operation has timed out. The inner
exception is null.
Also, everything is local but when I do this (in chrome) it takes a good load of time! Its scary to think of how it would perform in production?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,今天我安装了fiddler并尝试了它,它有效!我还用 linqpad 查询了该服务,没有问题!
尽管今天我一直在使用 wcf 数据服务,并且由于各种错误而在访问数据时遇到了很多问题,但数据连接仍然打开,某些错误在字段中插入了多余的数据等。
Fiddler 对于诊断错误非常有帮助,但很难找出到底出了什么问题,所以 fiddler 是必须的。
For some reason, today I installed fiddler and tried it and it works! I also, queried the service with linqpad and it worked no prob!
Although throughout today I played with wcf data services and had tons of problems accessing data because of all kinds of errors, data connection was still open, some error insert excess data in a field etc etc.
Fiddler was very helpful at diagnosing what the error was, its very difficult to figure out what really went wrong so fiddler is a must have.