472,334 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

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 8259
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Benne Smith | last post by:
Hi, I have a simple webservice, with one function on the following local path : http://localhost/testws/tester.asmx I would like to call it,...
3
by: jensen bredal | last post by:
I need a thread that loads the content of a database table in the cache (System.Web.Caching.Cache) i wrote therefore the code below: public...
8
by: Martinh | last post by:
Hi I keep getting this error... Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA:...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the...
0
by: Daniel Knöpfel | last post by:
Hi We have developed a webservice that was accessed by a fat windows client. A security requirement was that the client authenticates itself by...
4
by: Oscar | last post by:
Hi, I got a webservie that supply users with binary files based on a parameter id. The method is void and I stream the file by: ...
0
by: anujitkarmakar | last post by:
I have tried calling web service using SOAP. I tried the following code. But did not work. Its giving the error. Code: protected void...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.