473,404 Members | 2,179 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,404 software developers and data experts.

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="true" /> to web.config but nothing changed.
Does anyone has an idea what is missing?
Thanks.

Nov 23 '05 #1
3 1707
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.public.dotnet.framework.aspnet.webservic es
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******@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.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="true" /> 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="true" /> 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.CredentialCache.DefaultCredentials;
--
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="true" /> 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.CredentialCache.DefaultCredentials;
--
Tom Porterfield

Nov 23 '05 #4

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

Similar topics

1
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...
3
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...
7
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...
4
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...
3
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 : ...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

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.