JSON WCF display blank page in C# -


i create console application wcf.

my class isimpleservice

[servicecontract()] public interface isimpleservice {     [operationcontract]     person getdata(string id);  } 

my class simpleservice

public class simpleservice:isimpleservice {     [webinvoke(method = "get",                  responseformat = webmessageformat.json,                  uritemplate = "data/{id}")]     public person getdata(string id)     {         // lookup person requested id          return new person()                    {                        id = convert.toint32(id),                         name = "leo messi"                    };     } }  public class person {     public int id { get; set; }     public string name { get; set; } } 

my program class

class program {     static void main()     {         //create uri serve base address         var httpurl = new uri("http://localhost:8090/myservice/simpleservice");         //create servicehost         var host = new servicehost(typeof(simpleservice), httpurl);         //add service endpoint         host.addserviceendpoint(typeof(isimpleservice)         , new wshttpbinding(), "");         //enable metadata exchange         var smb = new servicemetadatabehavior         {             httpgetenabled = true         };         host.description.behaviors.add(smb);         //start service         host.open();          console.writeline("service host @ " + datetime.now.tostring(cultureinfo.invariantculture));         console.writeline("host running... press <enter> key stop");         console.readline();     } 

my problem when go http://localhost:8090/myservice/simpleservice/data/5 , displays blank page. debug method getdata(string id) , doesn't run method. how solve it?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -