Beta2 and File Server Web Services – Some problems and solutions

I had two problems calling web services with a VS2005 app that I moved from Beta1 (Feb CTP) to Beta2.

I have a client and a web service app. Both are running on a file based web server, not IIS.

The web service was functioning properly when I ran it directly, but not when I tried to call it from the client app.

Problem #1: Web Server Port #
Error: “No connection could be made because the target machine actively refused it.”

When you set a web reference to a web service, the port number currently associated with that web service is embedded into the web.config file inside of the <app settings> section.

<add key=localhost.Service value=http://localhost:1719/MyServices/ServiceFoo.asmx/>

I had mucked around with moving my files around enough that the saved port number was still in my web.config, but the computer had assigned a new port.

You can edit the web.config to identify the correct port number or just remove and readd the web reference which will update the web.config for you.

Problem #2: Authentication problem
Error: “The request failed with HTTP status 401: Unauthorized.”

This threw me because I was not using IIS and that is such an IIS message. I had an inkling that it was because I had been trying to run vs2005 as a non-admin and I had messing with folder permissions, file sharing, etc. After hours and hours of googling to no avail, I finally noticed the new “NTLM Authentication” setting in the [still very unfamiliar feeling] property pages for the web projects (Start Options). I crossed my fingers and turned off the NTLM Authentication on the web service project, and my problem disappeared.

I believe that this might be related to something that I found listed in the VS Known Issues doc for Beta 2. There was a reference to getting 401’s when doing unit tests in and the workaround suggested is to remove the credentials.

I hope my pain and suffering saves someone else from wasting a Sunday afternoon. 🙂

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.