You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a problem.
Make Http request from nodejs client to a Windows Server 2012 IIS with WCF hosted (self made code).
pasted only the method on nodejs which does the job.
There is properties in the object where serviceUrl and others are definied.
post(options, parameters = undefined){
var postData = "";
var instance = this;
var opts = {
hostname: this.serviceUrl,
port: this.port,
path: "/",
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cookie': this.cookieJar,
}
};
var headers = opts.headers;
options = Object.assign(opts, options);
options.headers = Object.assign(headers, options.headers);
if(parameters !== undefined){
postData = JSON.stringify(parameters)
}
var request = http.request(options);
for(var key in options.headers){
request.setHeader(key, options.headers[key]);
}
return new Promise((resolve, reject) => {
try{
if(parameters !== undefined){
request.write(postData, "utf-8");
}
request.end();
request.on('response', function (response) {
if(response.headers["set-cookie"] != undefined){
instance.cookieJar = response.headers["set-cookie"];
}
var statusCode = response.statusCode;
if (!((200 <= statusCode && statusCode < 300))) {
reject(new HttpRequestError(`Response statusCode: ${response.statusCode}, responseText: ${response.statusMessage}`, request, response));
return;
}
var data = "";
response.setEncoding('utf8');
response.on('data', function (chunk) {
data += chunk;
});
response.on("end", function(){
if (response.headers["content-type"] && ~response.headers["content-type"].toLocaleLowerCase().indexOf("application/json")) {
try {
data = JSON.parse(data);
} catch (error) {
reject(error);
return;
}
}
resolve(data);
});
});
request.on('error', function (err) {
reject(err);
});
}catch(err){
reject(err);
}
});
}
}
Lets say this WCF endpoint is called previously.
public Boolean Log(List<Log> logs, Truck truck)
{
try
{
... do some stuff
}
catch (Exception ex)
{
var msg = ex.Message;
msg = msg.Replace(System.Environment.NewLine, "");
var e = new Exception(msg);
throw e;
}
return true;
}
When i do not replacing System.Environment.Newline in the exceptions Message then on the nodejs side raises ECONNRESET and cannot get the exception details thrown in WCF.
When i do replace the System.Environment.Newline in the exceptions Message the nodejs got the statuscode 500, got the exception raised in WCF as responseBody formatted as expected.
(Works as need to work in this situation)
Tested these two behaviors. And with these information you can reproduce it
The text was updated successfully, but these errors were encountered:
Version:
v8.16.2
Platform:Linux raspberrypi 4.19.66-v7+ Switch ClosureLinter to other linter. node#1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Subsystem: http requests
Windows version:
Windows Server 2012
** Host**:
IIS 8.5
WCF Application .NET 4.5
I ran into a problem.
Make Http request from nodejs client to a Windows Server 2012 IIS with WCF hosted (self made code).
pasted only the method on nodejs which does the job.
There is properties in the object where serviceUrl and others are definied.
}
Lets say this WCF endpoint is called previously.
When i do not replacing System.Environment.Newline in the exceptions Message then on the nodejs side raises ECONNRESET and cannot get the exception details thrown in WCF.
When i do replace the System.Environment.Newline in the exceptions Message the nodejs got the statuscode 500, got the exception raised in WCF as responseBody formatted as expected.
(Works as need to work in this situation)
Tested these two behaviors. And with these information you can reproduce it
The text was updated successfully, but these errors were encountered: