If you encounter the same problem, find some information on the webpage and record it first!
Server nhibbench 3.0 + WCF. When the client calls the API, if the query involves Association queries, either one-to-many or multiple-to-one
Error: unable to read data from the transmission connection: the remote host forces an existing connection to be closed. It is difficult to identify the error. At the beginning, the query times out and the problem persists after the configuration file is modified.
The server console prints SQL statements and shows that the query is complete. Most of the queries on the Internet are about serialization. Modify the maximum serialization value in the configuration file, flip the blog of several foreigners, and rewrite datacontractserializeroperationbehavior, the English language is too bad to copy the example. However, after a comprehensive analysis, we finally solved the problem. The second query takes a long time, because the existing project is generated using the Nhibernate module of codesmith.CodeThe templates used for self-writing examples are different. If the result example is successful and fails to be put into the project, the generated client code is compared before being released.
Solution:
1. Multiple-to-one, lazy = "false"
2. for one to multiple objects, the bag ing type in the object configuration file is bag, and the attribute corresponding to the object class must be a set of strong types such as ilist <user>, otherwise, the corresponding property in the code generated by the client is ilist <Object>.
3. Add isreference = true to object class serialization configuration, for example, [datacontract (isreference = true)].
I just got in touch with WCF, and it's time to get started.
Transferred from:
Http://www.oschina.net/question/25945_20177