Some time ago, I looked at WCF and basically learned about the process of WCF. Basically, an interface is used for communication. I am not very clear about the specific internal knowledge.
Today, I want to know nothing about it, just as I would like to study it myself. I also want to see if I can write the interfaces in WCF separately, that is, I can uninstall different projects. I did this today. The first problem I found was that I could not access it. That is, the client endpoint node issues.
1. Address Settings. The settings here should be the same as the address settings on the host side, so that you can access the host through the interface.
2. Contract settings problems. I used to set the interface corresponding to the host interface. However, this setting always fails and was discovered later, it turns out that the interface configured here is the client interface, that is, the interface inherited from the client.
In this way, the problem is basically solved.
Then we found a magic problem, "TCP error code 10061: Unable to connect because the target computer is actively rejecting it. "
I started the host in the debug folder (Project/bin/debug. Then the service address is opened in the browser. Correct. Why can't it be accessed,
After being depressed for more than an hour, I still couldn't find a solution. So I went to Google and found many similar problems. In the http://topic.csdn.net/u/20090508/17/5ba7618d-035d-498e-8b35-0573ea269706.html this post found, there may be a lot of problems, buddy can only be tested one by one, the result is sad reminder is, the problem is still.
Later, I started the host in the debug folder and then started the client. What's amazing is that the problem was solved. I thought it was my solution. The same problem still exists when I use the source code for debugging. This time I should have found the root cause of the problem. The problem may be that the client is started before the host because of the multi-project startup I set in solution in vs2008. I adjusted their order and found that the problem still persists. Then I added some code to the client to add the main thread. sleep (5000); then the problem is solved during the test.
Ah! It's really troublesome.