473,569 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Reques t.UserHostAddre ss()":

Unhandled Exception: System.InvalidO perationExcepti on: HttpContext is not
available. This class can only be used in the context of an ASP.NET request.
at System.Web.Serv ices.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_Sta rt 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 8401
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.Reques t.UserHostAddre ss()":

Unhandled Exception: System.InvalidO perationExcepti on: HttpContext is not
available. This class can only be used in the context of an ASP.NET request.
at System.Web.Serv ices.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_Sta rt 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
16168
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 all the parameters in), like this; http://localhost/testws/tester.asmx/myfunction?param1=hello&param2=world
3
4944
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
2149
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: System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
7
2006
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
19573
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 having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return...
0
2018
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 webserver (iis) made then sure that only clients providing a valid certificate could connect. (settings: Requeire secure channel, Require client...
4
9098
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"; HttpContext.Current.Response.BinaryWrite(arrResult); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End();...
0
1399
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) { string strSoapEnvelope = ""; strSoapEnvelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; strSoapEnvelope +=...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7931
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7682
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3663
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3655
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
954
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.