Project knowledge point Accumulation
This document takes snapshots of some knowledge points learned by the project for future reference.
WCF and dbnull
When using WCF to transmit data, sometimes some Special Vertex types need to be transmitted, such as dbnull, so that the service will throw an error because the service cannot identify the type and Cannot serialize it normally.
Solution:
(1) For custom datacontract, add the knowntype attribute to the Contract definition body, as shown below:
[Datacontract]
[Knowntype (typeof (system. dbnull)]
(2) if it is a service method (for example, an error occurs when the encapsulated executescalar transmits dbnull), add serviceknowntype attribute to the interface definition of the method, as shown below:
[Serviceknowntype (typeof (system. dbnull)]
Object executescalar (...);
Above, over!
View port usage
Wsdualhttpbinding is used in WCF, and port 80 is used for callback. However, it is annoying that port 80 is always occupied by other applications on the machine. You can view it in the following ways:
Netstat-ano | find ": 80"
Result: TCP 0.0.0.0: 80 0.0.0.0: 0 listening 3328
Where 3328 is the process ID, you can go to the task manager to check, you can also use the following command:
Tasklist | find "3328"
Result: mxdownloadserver.exe 3328 console 0 3,228 K
In this way, you will know which application is in use. The above, over!
Monitor port communication status
When I encountered a problem in using WCF, I needed to monitor the Communication Status of port 80 on the machine. However, after searching for a long time, I did not find the available Sniffer Pro cracked version (Khan ...).
Therefore, we changed the tool to use windumpat at http://www.winpcap.org/default.htm.
Run the following command:
Windump-I 2 port 80> C: \ logfile.txt
You can record all the port 80 communications to the specified file. The above, over!
TF status/S: tfs001/User: *> C: \ 007.txt
Tf.exe is in the c: \ Program Files \ Microsoft Visual Studio 9.0 \ common7 \ ide directory.
Check the TFS File status (checkout)
TF status/S: tfs001/User: *> C: \ 007.txt
Tf.exe is in the c: \ Program Files \ Microsoft Visual Studio 9.0 \ common7 \ ide directory.