473,903 Members | 3,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Service "HTTP Status 401" -> "HTTP Status 404" issue

7 New Member
I've been banging my head against the wall with this one for a couple days so I'm hoping someone has some ideas. I have a web service that I created that is called by a .NET class library (which in turn is called by another application). This all works fine in my development environment.

Test environment: Windows Server 2003, ASP 6.0, .NET 2.0, Anonymous authentication is enabled. All components (web service, DLL, and calling application) are all on the same server.

I first got the error "The request failed with HTTP status 401: Unauthorized." After some research I added...

< authentication mode="Windows" / >
< identity impersonate="tr ue" / >

... to the web.config file for the web service and ...

iService.PreAut henticate = true;
iService.Creden tials = System.Net.Cred entialCache.Def aultCredentials ;

... to the class library code before the call to the web service.

After making that change, now I'm getting the error "The request failed with HTTP status 404: ." (no detail after the colon)

The web service works fine from the browser, it's only returning this error when called through the class library. I've tried a few things...

- Removed the virtual directory and recreated it
- Granted the IUSR and ASPNET accounts administrator priviledges to the virtual directory
- Added this code to the web.config file for the web service...

< defaultProxy >
< proxy usesystemdefaul t="false" / >
< / defaultProxy >

- Added this code to the class library before the web service call...

IWebProxy proxyObject = new WebProxy("http://testserver:8080 ", true);
iService.Proxy = proxyObject;

None of those changes resolved the issue, I still get the same error. (Note: From the same class library, I'm calling a couple other web services that reside on a different server and those calls are successful.)
Jul 18 '07 #1
11 8352
7,872 Recognized Expert Expert
Hmm. is your webproxy thing parsing the custom port correctly?
Is wherever this class library being called from have an accurate record for testserver (or even anyone listening on THAT computer? check to make sure server is bound to outside port and not just the localhost?)

Wierd errors. Can you debug it at all?
Jul 18 '07 #2
7 New Member
Everything is all on the same computer so it shouldn't be an issue with seeing the service or proxy. I'm going to try add a bunch of event logging statements to try to see what's going on, just hoping someone had seen something similar before going through that effort. Thanks for the comments. I'll post back if/when I resolve the issue in case someone else runs into the same thing.
Jul 19 '07 #3
9,735 Recognized Expert Moderator Expert
Hi JJw92,

Could you please clarify what you mean by this:
The web service works fine from the browser, it's only returning this error when called through the class library. I've tried a few things...
Have you seen the article supplied by Microsoft Support on HTTP Error 404 and IIS 6?

Jul 19 '07 #4
7 New Member
Could you please clarify what you mean by this:
The web service works fine from the browser, it's only returning this error when called through the class library. I've tried a few things...
Hi Frinny,

If I open IE and enter the URL of the .asmx file, I get the Service Description page. I can then click on the web service, enter parameter values, and click Invoke to test it. The service runs and returns a successful return code.

The web service is called from another server by an application not under my control and that call is also successful. I built a .NET assembly that, among other things, has a procedure to call the above web service and I made that assembly COM visible. I needed to do this because the calling application doesn't support calling web services or .NET assemblies (only COM DLLs).

I don't believe the issue in the article you linked to applies here since Active Server Pages is allowed, as well as ASP.NET 2.0. (Plus the web service runs successfully from the browser, as described above.)

Jul 19 '07 #5
7 New Member
In debugging the issue, I know that it gets to the iService.Create Trx() statement that calls the web service and all the parameters have valid values...
Expand|Select|Wrap|Line Numbers
  1. WebSvc.Integrate iService = new WebSvc.Integrate();
  2. iService.PreAuthenticate = true;
  3. iService.Credentials = System.Net.CredentialCache.DefaultCredentials;
  4. IWebProxy proxyObject = new WebProxy("http://localserver:80", true);
  5. iService.Proxy = proxyObject;
  6. bool bReturn = iService.CreateTrx(JobNum, ItemNum, Site, Qty, Update, false))
I added a logging statement as the first line of the web service and it never reaches that point.

I don't know if anyone can look at these log entries to determine what's happening but this is from the IIS log (appears to show both 401 and 404 errors)...

2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 - Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 401 2 2148074254
2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 - Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 401 1 0
2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 ITDEVELOP\jdoe Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 404 0 0

No log entry is created in the web service log.

Any help would be greatly appreciated.
Thanks, Jim
Jul 20 '07 #6
7 New Member
401.2 - Logon failed due to server configuration.
401.1 - Logon failed.
404.0 - (None) – File or directory not found.

The first two of these seem to be standard handshaking "errors" usually followed by 200 when authentication completes. In my case, I'm getting that 404.0 log entry instead of 200.

Any tips on how to pinpoint the cause of this? As I said earlier, the web service runs fine when run through IE (via the Service Description page).

Jul 20 '07 #7
7,872 Recognized Expert Expert
These are the log entries for the failures yes? (I see the 40x error codes)
What do log entries for successful ones look like?

2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 - Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 401 2 2148074254
2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 - Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 401 1 0
2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 ITDEVELOP\jdoe Mozilla/4.0+(compatible ;+MSIE+6.0;+MS+ Web+Services+Cl ient+Protocol+2 .0.50727.42) 404 0 0
Jul 20 '07 #8
7 New Member
Yes, that's for a failed attempt. And interestingly, those log errors are appearing in the log directory for the "Default Web Site" not the log directory for my service. When processing a successful call though IE, it doesn't write to the "Default Web Site" log and writes this to the web service log...

2007-07-20 12:52:49 W3SVC2131071671 POST /WebSvc.asmx/CreateTrx - 8080 - Mozilla/4.0+(compatible ;+MSIE+7.0;+Win dows+NT+5.2;+.N ET+CLR+1.1.4322 ;+.NET+CLR+2.0. 50727) 200 0 0

So could it be that the call from the DLL is hitting port 80 even though I'm specifying port 8080?
Jul 20 '07 #9
7,872 Recognized Expert Expert
I would say, based on the log that yes it's trying port 80, it says it in the log.
Expand|Select|Wrap|Line Numbers
  1. 2007-07-20 04:54:49 W3SVC1 POST /_vti_bin/owssvr.dll - 80 
And, back to my very first point in this thread which was
Hmm. is your webproxy thing parsing the custom port correctly?
You should go through that DLL really close and find out why it's ignoring the custom port specification.
Jul 20 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Christian Eriksson | last post by:
Hi! I want to clarify, for myself, some basic facts about Oracle Client Server configuration. I start with the listener configuration on the server side. What block(s) in what configuration file(s) defines the services (shown below)? What causes there to be more than one instance of a service (shown
by: Andrew Yinger | last post by:
Hi. I have recently encountered a serious problem with mysql: the mysqld-nt service pegs the processor at 100% after I start it. I noticed this right after a crash of the service, and the size of one of the tablespaces (the second, auto-extending one) grew to larger than 500GB (it is now 503 GB). I have currently turned off all apps that access the DB, but the mysql process on the server still holds at 100% after I restart it. ...
by: pronto | last post by:
Hi guys. I made Web Service (C#) and running it on my localhost (Win2000). It does work from IE and from C# client application. Now I'm trying to create application with Visual C++ 6 and get access to the same WebService. What VC++ application does is : get HTML page from the URL and print it out to stdout. It does work with regular sites (like www.cnn.com), but when I specify URL to get access to my Web Service, I've got 401 error...
by: Michael Chong | last post by:
Another same issue on "NullReferenceException" :- I have an (exe) executable program created in VB.NET 2003 that calls to a MFC DLL written in VC++.NET 2003. I always get an error msg "NullReferenceException: Object Reference Not Set to an Instance of an Object" when my exe calls the following codes: in VB.NET Declare Function test Lib "C:\Cyob\IOComm\Debug\IOComm.dll" _ (ByVal a As Long, ByRef b As String) As Integer
by: Chuck Haeberle | last post by:
Its the classic scenario. We want our users to connect from their desktop to the web server and on to the database server using integrated windows authentication. It just wont work, even after I think I've done everything I'm supposed to for enabling delegation. IE is set to allow integrated authentication. ASPNET on the web server has permission to act as part of the operating system. web.config impersonate is set to true Active...
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
by: pagates | last post by:
Hello All, For links in my page, I would like to change the window.status to show something a little friendlier than "javascript:WebForm_DoPostBackWithOptions(.............)". I thought that using the ToolTip for the WebControl could be just the thing. I have a function (see below signature) that recursively looks at the controls on the page (and, if it HasControls, then at its child controls, etc.), starting at "this". If the...
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello everyone, I have this application that stops and starts IIS admin. When I try to stop the service. I get an error "Cannot open IISADMIN service on computer '.'.". I tried changing the machine name to my machine name then also it does not work. Below is the code ServiceController controller = new ServiceController();
by: tim | last post by:
Hi all, I want to execute a VB application from a ASP page (not .Net). Want I want to do is that I write some parameters to a database and then start the external application that will pickup these parameters and run in the background. I looked for a sample but I can't find any. Who can help me. Many thanks Tim
by: =?Utf-8?B?YXZhTmF0ZQ==?= | last post by:
We're having an issue getting our POX service to accept messages over 65k for some reason. When that threshold is breached, a 400 is issued by WCF...and it doesn't make it anywhere into the service. Code:
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...
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,...
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,...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.