473,671 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access denied on a web service

I wrote my web service and I have no problem browsing to the asmx file and
seeing the public methods. I can even invoke them with no problem. But in
my asp.net application I get this error message "The request failed with
HTTP status 401: Access Denied. "

BUT when I add this line to my code it works fine.

gsdiApplication gsdiWebService = new gsdiApplication ();
gsdiApplication .Credentials =
stem.Net.Creden tialCache.Defau ltCredentials; ------ when I add this line
it then works!
gsdiApplication .....
<code here>
gsdi.Dispose();

But I don't understand why I needed to add it? I never had to do anything
like that before. What required it this time?

Ed
Nov 19 '05 #1
2 1876
The short answer is because your web site demands it.

But to be a little less terse, the virtual directory in which your web
service is running has anonymous access turned off. This means that, in
order to access a page in that directory, credentials are required. If you
had hit a page with a browser, then behind the scenes the browser would have
received a request for credentials and provided them. However, the proxy
class used to access a web service doesn't do that. Instead, you need to
provide them, something you're doing by setting the Credentials property. If
you would rather not do this, then turn anonymous access on on the virtual
directory.

Hope this helps.

"Edward W." wrote:
I wrote my web service and I have no problem browsing to the asmx file and
seeing the public methods. I can even invoke them with no problem. But in
my asp.net application I get this error message "The request failed with
HTTP status 401: Access Denied. "

BUT when I add this line to my code it works fine.

gsdiApplication gsdiWebService = new gsdiApplication ();
gsdiApplication .Credentials =
stem.Net.Creden tialCache.Defau ltCredentials; ------ when I add this line
it then works!
gsdiApplication .....
<code here>
gsdi.Dispose();

But I don't understand why I needed to add it? I never had to do anything
like that before. What required it this time?

Ed

Nov 19 '05 #2
thank you. I looked at it further today. What I did was go into internet
manager directly (windows xp pro) and create a new virtual directory for the
web service. Then I created the web service in VS.NET 2003 and pointed to
the URL of the virtual directory I had just created. When I go into the
properties of the virtual directory from within inetmgr, I see as the first
tab it's named "Virtual Directory."

Next I created a new solution and added a web service as a project but I let
VS.NET create the IIS directory. Then in inetmgr, I checked the properties
of the web service site and noticed the first tab is called just "Directory"
and also it has a Server Extensions tab.

So what I did differently than I normally had done was to create the IIS
directory first before I created the web service. I did this so I could
control where the files were, namely not in the inetpub\wwwroot folder.

So my question is, how can I create the directory manually first, and what
do I choose if I shouldn't choose "virtual directory"?

thanks
Ed

"Bruce Johnson [.NET MVP]" <Bruce Johnson [.NET
MVP]@discussions.mi crosoft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
The short answer is because your web site demands it.

But to be a little less terse, the virtual directory in which your web
service is running has anonymous access turned off. This means that, in
order to access a page in that directory, credentials are required. If
you
had hit a page with a browser, then behind the scenes the browser would
have
received a request for credentials and provided them. However, the proxy
class used to access a web service doesn't do that. Instead, you need to
provide them, something you're doing by setting the Credentials property.
If
you would rather not do this, then turn anonymous access on on the virtual
directory.

Hope this helps.

"Edward W." wrote:
I wrote my web service and I have no problem browsing to the asmx file
and
seeing the public methods. I can even invoke them with no problem. But
in
my asp.net application I get this error message "The request failed with
HTTP status 401: Access Denied. "

BUT when I add this line to my code it works fine.

gsdiApplication gsdiWebService = new gsdiApplication ();
gsdiApplication .Credentials =
stem.Net.Creden tialCache.Defau ltCredentials; ------ when I add this
line
it then works!
gsdiApplication .....
<code here>
gsdi.Dispose();

But I don't understand why I needed to add it? I never had to do
anything
like that before. What required it this time?

Ed

Nov 19 '05 #3

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

Similar topics

0
2633
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The web methods can be invoked successfully if "WebApplication1" is located in machines with the same subnet (128.1.7.x). However, it fails if "WebApplication1" is hosted on
0
3532
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the original question, the subject line is: ADODB.NET and "Access Denied" I have an ASP.NET page writtein in VB that uses ADODB. I just had to
4
2908
by: Bruce | last post by:
I am developing an ASP.NET web service application. It works fine on my WinXP Prof development machine. But when I send it to a Windows Server 2003 system I get the following error (attached below). I suppose I have some kind of permissions issue on the server? What recommendations can anyone propose? Thanks, -- Bruce
3
7994
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
3
7955
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images C:\Inetpub\wwwroot\RunReportASP is the directory of my virtual directory for my app. In it's properties I did check "Write" as a permission. What else do I need to do?
7
19730
by: hufaunder | last post by:
I have a website that uses a web service that is located on the same machine. This webservice calls a program which in return modifies a file in c:\documents and Settings\All Users\Application Data\...'. Unfortunately, whenever the webservice is executed I get the following error message: Access to the path 'C:\Documents and Settings\All Users\Application Data\...' is denied. Permissions for the default website (where the website and...
4
21717
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
0
430
by: royan | last post by:
Help please! I have the same problem which this post http://groups.google.com/group/microsoft.public.vsnet.vstools.office/browse_thread/thread/91275741fa1e100f/164638c6d6ba3872?lnk=gst&q=System.UnauthorizedAccessException%3A+Access+is+denied.&rnum=1&hl=en#164638c6d6ba3872 When I deploy our ASP.NET Application web form to Windows server 2003 I got access deny error. We are using the Microsoft.Office.Interop.Word COM DLL. We need to read a...
0
3948
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was getting the Access denied error. After checking different settings and googling I wasnt able to pinpoint the problem and as a temporary fix I decided to merge the two assemblies into one, my logic being no offending assembly no access denied...
2
5334
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens - I suspect users do have tokens, hence "user token", otherwise we might call them "service tokens" or somesuch :-) If you read the question again, you migh see that the fundamental question is, *assuming there is no other approach*: The...
0
8471
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8388
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8817
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...
0
8663
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
7423
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6218
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4215
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...
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
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.