WCF 数据服务托管在 Windows 窗体中 [英] WCF data service hosting in Windows Form

查看:26
本文介绍了WCF 数据服务托管在 Windows 窗体中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以 windows 形式托管 WCF 数据服务(以前称为 ADO.NET 数据服务).这可能吗?如果是,那么有没有博客,谈论它?我知道 WCF 可以托管在 Windows 窗体中,但我不确定 WCF 数据服务,因为我看到的所有示例都要求创建 ASP.NET Web 项目.

I want to host a WCF Data Service (formerly known as ADO.NET data Service) in windows form.Is it possible? If yes,then is there any blog, which talks about it? I know WCF can be hosted in Windows Form, but I am not sure about WCF data service, as all the examples I see, is asking to create ASP.NET web project.

-Brajesh

推荐答案

在 WinForms 应用程序(或在我的情况下是单元测试)中托管 WCF 数据服务非常容易.

It is very easy to host a WCF Data Service in a WinForms application (or in my case a unit test).

// add reference to System.Data.Services

// identify your endpoint uri
Uri endpoint = new Uri("http://localhost:12345/MyDataService");
// create the data service host
DataServiceHost host = new DataServiceHost(typeof(MyDataService), new Uri[] { endpoint });

这篇关于WCF 数据服务托管在 Windows 窗体中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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