WCF development process-communication between the server and the client (including demo), wcfdemo
Before explaining the technology, I would like to ask Boyou to make me speak nonsense. Today is my first blog post I posted on my blog. (if there are similarities, it is absolutely impossible ). I have always been here to read the masterpiece of fellow bloggers. I have benefited a lot from this. Thank you for sharing it! The so-called goat has the grace of milk, the crow has the righteousness of feeding back, and the man has the message of kindness. The reward here is too high. If you write this blog post and talk about it, I hope you will wave it to me! To put it bluntly, this blog post mainly describes the overall process of developing a WCF project using a three-tier architecture model. The important thing is how the Server communicates with the client and some configurations for communication. The procedure is as follows.
1. Create a solution in VS. The project architecture diagram is as follows (with examples)
2. References of each layer
Each layer references System. ServiceModel;
The Service layer references the Contract layer; the Host layer references the Contract and Service layers;
Iii. Contract layer IHelloService. cs code
4. Service-layer HelloService. cs code
5. The Host layer needs to write app. config and program. cs.
App. config code configuration (or tool configuration ):
Code of program. cs
6. call the service and Test Service at the Client layer (when testing the service, you must first start the Host layer before the service can be referenced successfully, because in a solution, therefore, you must first start the Host to serve as the server, and then start the client to test the client service)
Reference Service
Http reference
TCP/IP Reference
7. After the service is complete, vs will automatically generate the app. config file of the client and generate
8. The last step is to call our server services for testing.
9. Test successful
Why can't I add service references in the WCF development DEMO of VS2008?
No, you can add service references no matter whether your host (service) is started or not.
However, if your service is not started, you cannot find it ..
An error occurred while adding the reference. It is not added in the reference.
Added in the Service References folder.
You must first right-click the project to add a service reference.
Net Wcf server how to send messages to all clients do not write (Duplex) hope to give a demo Q: 792801526
No duplex is required, so that the client can request the service at regular or irregular intervals.