473,766 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing web service.

Problem: Accessing web service causes exception – “The request failed with
HTTP status 401 : Access Denied”.
I created a web service on my local machine and then developed a separate
test solution (windows app) to test it. The above mentioned exception occurs
when program executes a call to a function in web service.
I created another simple web service that has only one method, HelloWorld.
Then I used the test application to call the HelloWorld function and still
got the same exception.
I can use the IE to successfully get the response from the web service.
I added <identity impersonate="tr ue" /> to web.config but nothing changed.
Does anyone has an idea what is missing?
Thanks.

Nov 23 '05 #1
3 1724
Hi:

Enable anonymous authentication in IIS for your web service.

This question has been asked and answered a couple of times in the last week
or so on this and the microsoft.publi c.dotnet.framew ork.aspnet.webs ervices
group. It's a good habit to look at the previous post for questions similar
to your that have got answers before posting your question. :-)

Thank you,
Mujtaba.

"Khalique" <Kh******@discu ssions.microsof t.com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
Problem: Accessing web service causes exception - "The request failed with
HTTP status 401 : Access Denied".
I created a web service on my local machine and then developed a separate
test solution (windows app) to test it. The above mentioned exception occurs when program executes a call to a function in web service.
I created another simple web service that has only one method, HelloWorld.
Then I used the test application to call the HelloWorld function and still
got the same exception.
I can use the IE to successfully get the response from the web service.
I added <identity impersonate="tr ue" /> to web.config but nothing changed.
Does anyone has an idea what is missing?
Thanks.

Nov 23 '05 #2
On Tue, 21 Dec 2004 09:33:05 -0800, Khalique wrote:
Problem: Accessing web service causes exception V The request failed with
HTTP status 401 : Access Denied.
I created a web service on my local machine and then developed a separate
test solution (windows app) to test it. The above mentioned exception occurs
when program executes a call to a function in web service.
I created another simple web service that has only one method, HelloWorld.
Then I used the test application to call the HelloWorld function and still
got the same exception.
I can use the IE to successfully get the response from the web service.
I added <identity impersonate="tr ue" /> to web.config but nothing changed.
Does anyone has an idea what is missing?
Thanks.


Do you have your virtual directory in IIS setup for anonymous access? IE
will automatically send security credentials if the zone is intranet or
computer. If you want security credentials to be passed to a webservice
from within your code, you must set them. The following example should
work:

webServiceProxy .Credentials =
System.Net.Cred entialCache.Def aultCredentials ;
--
Tom Porterfield
Nov 23 '05 #3
Thanks Mujtaba and Tom.
Setting credentials solved the problem.
Mujtaba, I did not want to allow Anonymous Access and that is why I had
disabled that. And I looked for an answer in the previous posts in last few
days. However, I did not go back before 16 of this month.
Thanks a lot for your valuable help
Khalique.

"Tom Porterfield" wrote:
On Tue, 21 Dec 2004 09:33:05 -0800, Khalique wrote:
Problem: Accessing web service causes exception – “The request failed with
HTTP status 401 : Access Denied”.
I created a web service on my local machine and then developed a separate
test solution (windows app) to test it. The above mentioned exception occurs
when program executes a call to a function in web service.
I created another simple web service that has only one method, HelloWorld.
Then I used the test application to call the HelloWorld function and still
got the same exception.
I can use the IE to successfully get the response from the web service.
I added <identity impersonate="tr ue" /> to web.config but nothing changed.
Does anyone has an idea what is missing?
Thanks.


Do you have your virtual directory in IIS setup for anonymous access? IE
will automatically send security credentials if the zone is intranet or
computer. If you want security credentials to be passed to a webservice
from within your code, you must set them. The following example should
work:

webServiceProxy .Credentials =
System.Net.Cred entialCache.Def aultCredentials ;
--
Tom Porterfield

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3961
by: Eirik Brattbakk | last post by:
Hi I have some problems accessing a soap service made in c# using an ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and CSoapWininetClient as template arguments with my stub class. The service is returning with the error code: -2147467259. I have not succeeded to find any additional information about the error. The "SoapFault" method seems to return only a bunch of question marks.
3
7677
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the error below. Can I access a Web Service through a Query Sting. I need to send XML to a Flash movie using a Web Service. Thank You, Jim Lewis Server Error in '/WebService1' Application.
7
7115
by: David Laub | last post by:
I've also posted this issue to a Sun/java formum, but since it appears to be an integration issue, this may be the better place to posr: I have written a dot net/c# Web Services doesn't fully work with J2ME client a) c# web service works with c# WIndows Client (local & remote web service) b) c# web service works with J2ME client - when the Web Service is local c) c# web service fails with J2ME client - when the Web Service is remote ...
4
3780
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For testing purposes, the secure place is setup on the client machine. The client (window app) calls the web service (on a different machine) and connects successfully to the web service. However, when client calls a method that copies the file from...
3
5006
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
0
10168
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10008
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5279
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.