by scott.iisy » Fri, 30 Mar 2007 08:58:00
i,
I have a web service which works fine under the ASP.NET development
server (on default port 4219) and also from an ASP.NET client with a
reference to the deployed service. However, I'm unable to access the
service from a windows application. I have only used ASP.NET in the
past to consume a web service, and hope I am just doing something
stupid. I've verified the service is running under IIS and I've set
the permissions to public access. I've also tried accessing the
service through both localhost and the computer name, but get the same
"Unable to connect to the remote server" error.
An ASP.NET form with a button has the following code behind and works
fine:
Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim di As dealerInterface.DealerInterface
di = New dealerInterface.DealerInterface
Dim xn As System.Xml.XmlNode
xn = di.SendQuote("<?xml version=""1.0"" encoding=""utf-8"" ?
TextBox2.Text = xn.OuterXml()
End Sub
The *exact* same code in a VB windows app (using the same web
reference URL) gives the following exception:
System.Net.WebException was unhandled
Message="Unable to connect to the remote server"
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetRequestStream()
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at
WindowsApplication1.DealerInterface.DealerInterface.SendQuote(String
strXml) in C:\IISCorp\Projects\TM Window and Door
(168)\WindowsApplication1\WindowsApplication1\Web References
\DealerInterface\Reference.vb:line 85
at WindowsApplication1.Form1.Button1_Click(Object sender,
EventArgs e) in C:\IISCorp\Projects\TM Window and Door
(168)\WindowsApplication1\WindowsApplication1\Form1.vb:line 8
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext
context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsForms