API响应:StatusCode:0,Content-Type :, Content-Length:0

时间:2017-06-18 11:05:25

标签: c# restsharp rest-client

我从C#发送请求时收到状态码0。但是当我从Postman发送相同的请求时,我得到状态代码200。

你可以帮助我,哪里出了问题?

var express= require('express')
, app = express()
, usersHandlers = require('./handlers/users');

app.use("/users",usersHandler);

function usersHandler(req,res){
    var version = req.query.version;
    console.log("This code is relevent for all versions");
    usersHandlers[version](req,res);
}

app.listen(8000,function(){
    console.log('Server running at http://127.0.0.1:8000/');
});

响应: StatusCode:0,Content-Type :, Content-Length:0 "底层连接已关闭:发送时发生意外错误。"}

1 个答案:

答案 0 :(得分:0)

您在调用BaseAddress构造函数时已使用RestRequest。这个多余的基地地址已经传递给RestClient。请参阅正确的变体:

var request = new RestRequest("resource/afpd-eane?spot_id=9747", Method.GET);