WCF应用:宿主与调用纯代码示例(Host &Client code only sample)
2012-11-27 14:13
435 查看
There are different ways to host a WCF appliaction. You can host it in:
IIS
WAS
Windows service
console application
The last one is very simple to do and I’ll will showYou how to do it.
First, create a new WCF Service Appliaction project. Then open the IService1.cs interface and add a custom method:
After that, implement this method in the Service1.svc.cs file. I did it like this:
Next create a new Console Application project and fill the Main function with this content:
That’s it. Now You have a fully functional WCF Service. TO test it You can create second console project and fill it like this:
ServiceReference1 is a reference You have to add to Your project. Simply do it by clicking RMB on the “Service Reference” node and the “Add Service Reference…”. Next step is to click “Discover” and when Your svc file is found click OK.
OK, now You can run first the service console app and then the test console app and You should see the results like this:
No tags
IIS
WAS
Windows service
console application
The last one is very simple to do and I’ll will showYou how to do it.
First, create a new WCF Service Appliaction project. Then open the IService1.cs interface and add a custom method:
OK, now You can run first the service console app and then the test console app and You should see the results like this:
No tags
相关文章推荐
- 微软发布Sample Browser for Windows 8版:数以千计示例代码,"触手可及"
- 详解JAVA调用WCF服务的示例代码
- 综合应用WPF/WCF/WF/LINQ之五:将Workflow使用WCF技术Host到IIS中,并实现调用
- jQuery调用WCF示例代码
- jQuery调用RESTful WCF示例代码(GET方法/POST方法)
- 宿主在Windows Service中的WCF(创建,安装,调用) (host到exe,非IIS)
- 【下载】Visual C++示例和代码 / Code Sample
- Flex应用BlazeDS时报错:[RPC Fault faultString="发送失败" faultCode="Client.Error.MessageSend"
- 推荐个找代码示例的VS 插件 All-In-One Code Framework Sample Browser
- jQuery调用RESTful WCF示例代码(GET方法/POST方法)
- Flex应用BlazeDS时报错:[RPC Fault faultString="发送失败" faultCode="Client.Error.Messag
- 推荐个找代码示例的VS 插件 All-In-One Code Framework Sample Browser(转)
- Flex应用BlazeDS时报错:[RPC Fault faultString="发送失败" faultCode="Client.Error.MessageSend"
- 宿主在Windows Service中的WCF(创建,安装,调用) (host到exe,非IIS)
- Flex应用BlazeDS时报错:[RPC Fault faultString="发送失败" faultCode="Client.Error.MessageSend" faultDetail="Cha
- WINCE调用WCF示例代码
- 推荐个找代码示例的VS 插件 All-In-One Code Framework Sample Browser
- jQuery调用WCF示例代码
- 推荐个找代码示例的VS 插件 All-In-One Code Framework Sample Browser
- WCF寄宿(Host)之自我寄宿(Self-Hosting)简单实例【Console应用为宿主】