473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 8384
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, using HTTP GET (or some form of simple, url with...
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 class Global : System.Web.HttpApplication {
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 ASP.NETFiles\webservice_isds\f12c6a5a\5975001" is denied. Stack Trace: ...
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: System.Web.Services.WebService { private int X = 0;
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 WSDL defines the output as an Object so I was...
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 using by providing a client certificate. The...
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: HttpContext.Current.Response.ContentType = "application/xxx";...
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 btnTestSoap_Click(object sender, EventArgs e) { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.