none
Can’t get Request.ServerVariable sometimes in WCF call, but always work in web service

    Question

  • Dear All,

    Recently we have met one headache issue as follows:

    Background:

    Application Pool 1(running in .Net 2):

    Asp and Asp.net app
    are running in this application pool, at
    the same time, one Web Service(used by Asp.Net) is running in this application
    pool as well, note that this  Web Service
    is exposed as WCF service which is used by Silverlight at the same time similar
    to following:

    [OperationContract]

    [WebGet]

    bool HasData(String id);

    Application Pool 2(running in .Net4)
    Silverlight app is running in this application pool.

    HTTP_USER is written in one ISAPI filter in request
    ServerVariable.

    Issues Description:

    Issue 1:

    HttpContext.Current.Request.ServerVariables["HTTP_USER"] in HasData method is
    sometimes null for WCF call(ServerVariables is not null in such case), however,
    it always correct for Web Service call.

    Issue 2:

    if the issue 1 occurs, then sometimes one of the WCF service
    is always not work, from Fiddler it shows there is internal error inside the
    service, and cannot be debugged(breakpoint always not hit).

    Analysis:

    The above issues do not happen always, the issues shall
    disappear temporally if recycle Application Pool 1 or reset IIS.

    Does the HTTPContext is same in Web Service and WCF service?
    Does application pool recycling/setting affect this?

    Anyone can shed some light on this?  Many thanks for your great help in advance,

    Yuanzi.

    Tuesday, March 13, 2012 7:36 AM

Answers

  • Hi Yuanzi,

    Thanks for your post.

    I suggest you use a console application to make a wcf call and check if this issue happens there as well.

    This will isolate the cause of silverlight application.

    If the issue persists with console client, I suggest you post it on IIS forum and i believe you will get better answer there.

     

    Best Regards,

    Friday, March 16, 2012 4:19 AM