469,602 Members | 1,830 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

WebService Error: HttpContext is not available.

While in a function of my web service that was called from another
application (not a web page), I get the an error when calling the function
"Context.Request.UserHostAddress()":

Unhandled Exception: System.InvalidOperationException: HttpContext is not
available. This class can only be used in the context of an ASP.NET request.
at System.Web.Services.WebService.get_Context()
at .....

I want to get the IP address from the client calling the web service. Why
is the Context not available? (I also noticed the Application_Start and
Session_Start events are not firing. While I don't need them, that may be a
clue to the problem).

Thanks in advance.

Nov 21 '05 #1
1 8050
Ok, so I needed to look at it one more time....

I had set it to a standard reference rather than a web reference. It didn't
dawn on me until I tried to run in outside of the solution (and at that point
it became really obvious).
"SRK_at_ISD" wrote:
While in a function of my web service that was called from another
application (not a web page), I get the an error when calling the function
"Context.Request.UserHostAddress()":

Unhandled Exception: System.InvalidOperationException: HttpContext is not
available. This class can only be used in the context of an ASP.NET request.
at System.Web.Services.WebService.get_Context()
at .....

I want to get the IP address from the client calling the web service. Why
is the Context not available? (I also noticed the Application_Start and
Session_Start events are not firing. While I don't need them, that may be a
clue to the problem).

Thanks in advance.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Benne Smith | last post: by
3 posts views Thread by jensen bredal | last post: by
8 posts views Thread by Martinh | last post: by
reply views Thread by Daniel Knöpfel | last post: by
4 posts views Thread by Oscar | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.