OneWay=true causes exception

R

Roger Down

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...
 
S

Som Nath Shukla

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top