c# - How to make keep-alive header response? -
i try make simple web api application , post.when response request:
{ "status": "ok", "headers": { "date": "fri, 18 aug 2017 16:50:38 gmt", "transfer-encoding": "chunked", "connection": "close", "content-type": "application/json; charset=utf-8", "server": "kestrel" }, "body": "....", "code": 200, "protocol": "http/1.1" } but want make "connection": "keep-alive", not "connection": "close" changed config.
startup.cs:
public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) { loggerfactory.addconsole(configuration.getsection("logging")); loggerfactory.adddebug(); app.usemvc(); app.usesession(); app.run(async (context) => { context.response.headers[headernames.connection] = "keep-alive"; }); } but, "connection": "close" response.
any idea how change "keep-alive" setting?
http/1.1 defines "close" connection option sender signal connection closed after completion of response. example, connection: close in either request or response header fields indicates connection should not considered `persistent' after current request/response complete.
if trying achieve persistent connection, may want websockets.
Comments
Post a Comment