I forgot about this little ditty with the last post. This class will take a webservice endpoint instance, and set it up for use with an instance of ProxyTrace running on port 81. You can see where to alter this if it's a problem.

using System;
using System.Diagnostics;
using System.Net;
using System.Web.Services.Protocols;

namespace Utility
{
    /// <summary>
    /// Summary description for ProxyTrace.
    /// </summary>
    public class ProxyTrace
    {
        private static bool ProxyTraceIsRunning()
        {
            Process[] processes = Process.GetProcessesByName("proxyTrace");
            if (processes == null)
                return false;
            if (processes.Length == 0)
                return false;
            return true;
        }

        private static string FixUrl(string originalUrl)
        {
            if (originalUrl.ToLower().IndexOf("//localhost") > 0)
                return originalUrl.Replace("//localhost", string.Format("//{0}", Environment.MachineName));
            else
                return originalUrl;
        }

        public static void Configure(SoapHttpClientProtocol service)
        {
            service.Url = FixUrl(service.Url);
            if (ProxyTraceIsRunning())
                service.Proxy = new WebProxy("localhost", 81);
        }
    }

}


This will work with normal webservices, or WSE enhanced webservices. Both class types descend from SoapHttpClientProtocol.