none
Sending connection:close from a WCF service hosted on windows service (wininet) RRS feed

  • Question

  • Hi,

    We have a requirement to send connection : close to the clients from the wcf service hosted on windows service (wininet). I went through lots of forums and seems like "Connection:close" is filtered out in WININET . We are using the following code to send the header : 

    //reply is the System.ServiceModel.Channels.Message object

    var httpResponseProperty = new HttpResponseMessageProperty();

    httpResponseProperty.Headers.Add(HttpRequestHeader.Connection, "close");

    reply.Properties[HttpResponseMessageProperty.Name] = httpResponseProperty;

    Is there a work-around for this? How can we send connection : close from web services hosted in windows (WININET)? Would appreciate any help on this!

    Note - I also checked the forums where it was suggested to close the handle but it seems that it did not work for others.

    Thanks,

    Karan

    • Moved by May Wang - MSFT Friday, November 1, 2013 3:35 AM for a better support
    Thursday, October 31, 2013 6:10 PM

Answers

All replies

  • Hi Karan,

    >>We have a requirement to send connection : close to the clients from the wcf service hosted on windows service (wininet).

    Can you clarify your issue more clearly, what do you mean with "send connection: close to the clients"?

    Thank you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 1, 2013 3:30 AM
    Moderator
  • Hi,

    We want to send a header "Connection : Close", in the response message to the clients . I read through variety of articles and according to them, in Microsoft Windows Internet Services (WinInet) or web services hosted in windows services, this header is stripped off. I am unable to attach the Knowledge base article on this forum as it is not allowing me to.

    Thanks,

    Karan

    Friday, November 1, 2013 4:10 AM
  • Hi Karan,

    It seems that you want add a custom header to the call, you could try creating a class that implements IClientMessageInspector, add your custom header to the outgoing message in the BeforeSendRequest method. There are some reference you can take a look.

    http://stackoverflow.com/questions/964433/how-to-add-a-custom-header-to-every-wcf-calls

    #Add Custom Message Header in WCF 4 Calls

    http://www.codeproject.com/Articles/352678/Add-Custom-Message-Header-in-WCF-4-Calls

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 5, 2013 12:34 PM
    Moderator