Host1=New ServiceHost (GetType (Rh_server. Login), the New Uri (" net. TCP://127.0.0.1:10000/")) Host1. Description. Behaviors. The Add (New ServiceMetadataBehavior ()) Host1. AddServiceEndpoint (GetType (IMetadataExchange), MetadataExchangeBindings. CreateMexTcpBinding (), "A") Host1. AddServiceEndpoint (GetType (Rh_server Ilogin), New NetTcpBinding (), the New Uri (" net. TCP://127.0.0.1:10000/login "))
Host2=New ServiceHost (GetType (Rh_server. A), the New Uri (" net. TCP://127.0.0.1:10000/")) Host2. Description. Behaviors. The Add (New ServiceMetadataBehavior ()) Host2. AddServiceEndpoint (GetType (IMetadataExchange), MetadataExchangeBindings. CreateMexTcpBinding (), "B") Host2. AddServiceEndpoint (GetType (Rh_server. Ia), New NetTcpBinding (), the New Uri (" net. TCP://127.0.0.1:10000/a "))
Host1. The Open () Host2. The Open ()
Make a winfrm as the host, the Tcp Wcf service, preparation is used to verify user name and the database access password, As if he had succeeded, this service is, each corresponding to a file, all want to build a ServiceHost relate to? These classes and properties all don't understand what you mean,
CodePudding user response:
ServiceHost only need one, you need multiple contract interface