App using WS gives 401 error from one box and not another.

E

Eric

I have the following situation:
An ASP.NET 2.0 app calls a web service, running on TestBoxB. When I run the
app (as a virtual directory) from DevBoxA, everything is fine. When I
create a new website on TextBoxB to host my app, and it calls the web
service on a different site also on TestBoxB, I get nothing but "The Request
Failed with HTTP 401: Unauthorized" messages back.

One thing we noticed is that if you bring up IE and type in the URL of the
ASMX file for the web service, it works fine if you do it from a box OTHER
than TestBoxB. However, if you log in to TestBoxB and perform the same
test, it asks for login credentials and wont accept any tried so far (keeps
asking for credentials over and over).

The settings for the website on TestBoxB are the same as the virtual
directory on DevBoxA: No Anonymous access and Integrated Windows
Authentication. We have tested both with Anonyous access ON and OFF with no
change in behavior.

On both boxes, the IIS application pool that runs the application has an
identity of Network Service.

All of the following code snippets have been tried with the same results:
svc.PreAuthenticate = false;
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
svc.CallSomeMethod("foo");
//----------------------------------------------
svc.PreAuthenticate = true;
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
svc.CallSomeMethod("foo");
//----------------------------------------------
System.Net.CredentialCache cache = new System.Net.CredentialCache();
cache.Add(new Uri(svc.Url), "Negotiate", new
System.Net.NetworkCredential("myAccount", "MyPassword", "MyDomain"));
svc.Credentials = cache;
svc.CallSomeMethod("foo");
//----------------------------------------------


Does anyone have any ideas?

Thanks,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top