System.InvalidOperationException was caught
HResult=-2146233079
Message=No owin.Environment item was found in the context.
Source=Microsoft.Owin.Host.SystemWeb
Localhost被击中但没有任何反应。 console.log(req)
时没有请求
casper.then(function(){
var server = "http://localhost:3000";
var params = { link: alldata[0].link };
var json = this.evaluate(function(server, params) {
try {
__utils__.sendAJAX(server, 'POST', params, true);
} catch(e) {
console.log("error sending post data");
}
}, server, params);
});
答案 0 :(得分:0)
首先,您正在编写路由功能,就像编写中间件一样:
app.post('/', function(req, res) {
console.log(req.body); //this will log the body
res.send(JSON.stringify(req.body)); //this will act like an echo route
});
app.listen(3000);
我假设你正在尝试发送一个JSON,如果你不是,你应该改变你的身体解析。如果你试图发送一个JSON,你应该修改你的AJAX,因为它正在发送一个key:value对象,它可能被翻译为表单帖子编码而不是JSON,这样做,只是为了确保:
__utils__.sendAJAX(server, 'POST',JSON.stringify(params), true);