OneWay=true causes exception

Discussion in 'ASP .Net Web Services' started by Roger Down, Sep 28, 2007.

  1. Roger Down

    Roger Down Guest

    I have used the SoapDocumentMethod(OneWay=true) on a web service.

    Inside all my web services, I want to know who is accessing the respective
    web service methods.

    So I used the following two lines for this:

    HttpContext httpContext = HttpContext.Current;
    string userHostAddress = httpContext.Request.UserHostAddress;

    When using this on a web service method not using the OneWay=true attribute,
    everything works fine.

    But on those web service methods where OneWay=true is added, I get the
    following exception...:

    Object reference not set to an instance of an object.
    at
    System.Web.Hosting.ISAPIWorkerRequestInProc.GetAdditionalServerVar(Int32
    index)
    at System.Web.Hosting.ISAPIWorkerRequestInProc.GetServerVariable(String
    name)
    at System.Web.Hosting.ISAPIWorkerRequest.GetRemoteAddress()
    at System.Web.HttpRequest.get_UserHostAddress()


    Is this by design or is this a bug ?

    Are there other ways of getting the client ip address when using the
    OneWay=true ?

    Best of regards...
     
    Roger Down, Sep 28, 2007
    #1
    1. Advertising

  2. hi
    u can use only onway=true when ur webmethod return type is void plz see
    it. and send the signature of webmethod.


    "Roger Down" wrote:

    > I have used the SoapDocumentMethod(OneWay=true) on a web service.
    >
    > Inside all my web services, I want to know who is accessing the respective
    > web service methods.
    >
    > So I used the following two lines for this:
    >
    > HttpContext httpContext = HttpContext.Current;
    > string userHostAddress = httpContext.Request.UserHostAddress;
    >
    > When using this on a web service method not using the OneWay=true attribute,
    > everything works fine.
    >
    > But on those web service methods where OneWay=true is added, I get the
    > following exception...:
    >
    > Object reference not set to an instance of an object.
    > at
    > System.Web.Hosting.ISAPIWorkerRequestInProc.GetAdditionalServerVar(Int32
    > index)
    > at System.Web.Hosting.ISAPIWorkerRequestInProc.GetServerVariable(String
    > name)
    > at System.Web.Hosting.ISAPIWorkerRequest.GetRemoteAddress()
    > at System.Web.HttpRequest.get_UserHostAddress()
    >
    >
    > Is this by design or is this a bug ?
    >
    > Are there other ways of getting the client ip address when using the
    > OneWay=true ?
    >
    > Best of regards...
    >
    >
    >
     
    Som Nath Shukla, Oct 3, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher D. Wiederspan
    Replies:
    0
    Views:
    1,752
    Christopher D. Wiederspan
    Dec 17, 2004
  2. bdb112
    Replies:
    45
    Views:
    1,399
    jazbees
    Apr 29, 2009
  3. Christopher D. Wiederspan
    Replies:
    0
    Views:
    145
    Christopher D. Wiederspan
    Dec 17, 2004
  4. Christopher D. Wiederspan
    Replies:
    1
    Views:
    192
    Dan Rogers
    Dec 20, 2004
  5. John Bailey
    Replies:
    3
    Views:
    577
    John Bailey
    Mar 9, 2007
Loading...

Share This Page