且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WCF 数据服务托管在 Windows 窗体中

更新时间:2023-12-06 14:18:16

在 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 });