//发送数据:
string parameterjson = JsonConvert.SerializeObject(rst);
System.Net.Http.StringContent content = new System.Net.Http.StringContent(parameterjson);
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
using (var httpClient = new HttpClient())
{
var response = await httpClient.PostAsync("http://localhost:9998/Gain1", content);
var responseString = await response.Content.ReadAsStringAsync();
PRs jo = JsonConvert.DeserializeObject<PRs>(responseString);
return jo.rs;
}
//接收数据
public class ApiModule : NancyModule
{
public ApiModule()
{
//Get["/"] = _ => "hello";
//Post["/Gain"] = _ =>
//{
//    //var p = this.Bind<PGain>();
//    PGain gain = new PGain();
//    var p = this.BindTo<PGain>(gain);
//    var rs = new PRs();
//    return Response.AsJson(rs);
//};
        Post["/Spec"] = _ =>
        {
            return Response.AsJson(new PSpec());
        };
    }
    public class PRs
    {
        public bool Rs { get; set; }
    }
}