473,383 Members | 1,792 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,383 software developers and data experts.

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

7
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="true" / >

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

iService.PreAuthenticate = true;
iService.Credentials = System.Net.CredentialCache.DefaultCredentials;

... 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 usesystemdefault="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 8286
Plater
7,872 Expert 4TB
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
jjw92
7
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
Frinavale
9,735 Expert Mod 8TB
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?

-Frinny
Jul 19 '07 #4
jjw92
7
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.)

Thanks!
Jim
Jul 19 '07 #5
jjw92
7
In debugging the issue, I know that it gets to the iService.CreateTrx() 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 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ Protocol+2.0.50727.42) 401 2 2148074254
2007-07-20 04:54:49 W3SVC1 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ Protocol+2.0.50727.42) 401 1 0
2007-07-20 04:54:49 W3SVC1 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 ITDEVELOP\jdoe 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ 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
jjw92
7
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).

Thanks!
Jul 20 '07 #7
Plater
7,872 Expert 4TB
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 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ Protocol+2.0.50727.42) 401 2 2148074254
2007-07-20 04:54:49 W3SVC1 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ Protocol+2.0.50727.42) 401 1 0
2007-07-20 04:54:49 W3SVC1 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 ITDEVELOP\jdoe 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+ Protocol+2.0.50727.42) 404 0 0
Jul 20 '07 #8
jjw92
7
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 192.168.1.211 POST /WebSvc.asmx/CreateTrx - 8080 - 192.168.1.211 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+.NET+CL R+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
Plater
7,872 Expert 4TB
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 127.0.0.1 POST /_vti_bin/owssvr.dll - 80 
  2.  
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
jjw92
7
Okay, thanks for the help. I'll check it out.
Jul 20 '07 #11
dorandoran
145 100+
Jim,

Can you post the code which took care of issue(s)?
Sep 22 '09 #12

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

Similar topics

4
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...
0
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...
1
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...
2
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...
2
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...
4
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...
0
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...
2
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...
7
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.