Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2004

Tip: Looking for answers? Try searching our database.

Accessing web service.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Khalique - 21 Dec 2004 17:33 GMT
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.
Mujtaba Syed - 21 Dec 2004 17:59 GMT
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.webservices
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.

> Problem: Accessing web service causes exception - "The request failed with
> HTTP status 401 : Access Denied".
[quoted text clipped - 8 lines]
> Does anyone has an idea what is missing?
> Thanks.
Tom Porterfield - 21 Dec 2004 18:19 GMT
> Problem: Accessing web service causes exception – “The request failed with
> HTTP status 401 : Access Denied”.
[quoted text clipped - 8 lines]
> 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;
Signature

Tom Porterfield

Khalique - 21 Dec 2004 19:21 GMT
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.

> > Problem: Accessing web service causes exception – “The request failed with
> > HTTP status 401 : Access Denied”.
[quoted text clipped - 17 lines]
> webServiceProxy.Credentials =
> System.Net.CredentialCache.DefaultCredentials;

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.