Silverlight 3 Chat application with WCF Duplex Binding
来源:互联网 发布:常见数据库面试题 编辑:程序博客网 时间:2024/05/28 15:38
How does the application work?
The ChatHost accepts connections from all Silverlight clients. Silverlight calls a login method on the ChatHost and the ChatHost holds a list of all connected clients.
When a Silverlight clients sends a message to the chatbox, the ChatHost will broadcast this message to all connected clients.
If it fails to deliver the message to the client, the client probably closed it's browser and is removed from the connected clients list.
Live example:
Tip: If there are no people to chat with, invite a friend or open 2 browser windows.
Client Access Policy
The ChatHost server is running on a different port number than the Silverlight webpage's (port 80). Because port 80 is used by IIS, the ChatHost can't host the WCF services on the same port number.
But Silverlight is not automatically allowed to access services on other servers/ports. So a Client Access Policy file (clientaccesspolicy.xml) must be provided by the target server.
The ChatHost can provide this file to Silverlight through the CrossDomainService.cs which is included in the ChatHost project.
How to get this working on your server?
- Download the source code
- Modify the App.config of the ChatHost and change the ServiceBase setting. Change the server name and port number to the name of your server and a port number you like.
- Modify the Silverlight project and specify the server name and port of the WCF endpoint (which you modified at step 2).
- Compile the projects
- Run the server
- Run Silverlight project
Download the full source code of the project here.
Silverlight Sockets
Are you looking for a socket based Silverlight chat application?
http://www.michielpost.nl/PostDetail_7.aspx
- Silverlight 3 Chat application with WCF Duplex Binding
- Pushing Data to a Silverlight Client with a WCF Duplex Service
- WCF duplex 简单实例
- Transfer file with WCF TCP binding.
- 稳扎稳打Silverlight(23) - 2.0通信之调用WCF的双向通信(Duplex Service)
- 稳扎稳打Silverlight(23) - 2.0通信之调用WCF的双向通信(Duplex Service)
- WCF-Binding
- WCF-Binding
- Silverlight Binding
- Silverlight Business Application 与 WCF Ria Service的使用 (3)
- [原创]我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- 我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- 我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- 我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- WCF Learning(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- 我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- 我的WCF之旅(6):在Winform Application中调用Duplex Service出现TimeoutException的原因和解决方案
- Binding to a dictionary in Silverlight with INotifyPropertyChanged
- Java 标准与规范
- Ant 中的一些命令
- 开始学习gdb
- 提升JSP应用程序的七大绝招
- LR测试时Error -27796的解决办法
- Silverlight 3 Chat application with WCF Duplex Binding
- [DirectShow] 009 - Graph-Building Components
- Linux fstab参数详解
- sql server2005取得表描述
- ASP连接各种数据库的方法
- Linux Shell简介
- 王爽不厚道,第一个例子连接就不过,报entry point must be defined,难道他不是用的基本编译器masm5?
- 项目失败的教训
- 文件上传,支持批量上传