c# - How to create a host application to receive data and send a response back -
i new programming , have given project have no idea how it.
i have write host application.the following requirement:
develop cxml webservice host testing cxml posts xyz.net .
the application should read stream of data,validate against dtd. store in corresponding tables , send response client.
this should example. create console application, , set startup object selfhost. run application , wcf service should available @ url stated code : http://localhost:1234/hello"
[servicecontract()] public interface iindexer { [operationcontract] bool test(); } public class indexer : iindexer { public bool test() { return true; } } class selfhost { static void main(string[] args) { uri baseaddress = new uri("http://localhost:1234/hello"); // create servicehost. using (servicehost host = new servicehost(typeof(indexer), baseaddress)) { // enable metadata publishing. servicemetadatabehavior smb = new servicemetadatabehavior(); smb.httpgetenabled = true; smb.metadataexporter.policyversion = policyversion.policy15; host.description.behaviors.add(smb); // open servicehost start listening messages. since // no endpoints explicitly configured, runtime create // 1 endpoint per base address each service contract implemented // service. host.open(); console.writeline("the service ready @ {0}", baseaddress); console.writeline("press q , <enter> stop service."); console.readline(); // close servicehost. host.close(); } } }