Hi,
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"" ?
> <Quote app_id=""1234567890ABCDEF1234ABCDEF"" />")
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.WindowsFormsApplicationBase.Run(String[]
commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Granted, "TextBox2" is a different underlying control in the two apps,
but the Windows app doesn't even get to this line, as the exception is
thrown on the web service method invocation. Essentially I only have
this line in there to see the correct result from ASP.NET.
I would really appreciate any help!!
Thanks very much,
Scott
JM - 05 Apr 2007 03:57 GMT
Scott, that's a tough one. However, I've seen some pretty flaky
things happen - one of which is the .Net Framework version setting in
IIS. Somehow, from time to time, something will change the framework
version in IIS for my web service to 1.1, when it should be 2.0. This
has caused the symptom that you are describing. Perhaps it's a simple
matter of changing your framework version.
On a related note:
Do you work with web services frequently? If so, do you use a utility
for testing them? I wanted to brag about a utility that I use. No
coding test harnesses to invoke your methods, analyze results, etc.
This proggie does it all, from getting data structures, results,
statistics, the whole bit.
About the utilty:
Company: DigitForge (http://www.digitforge.com)
Utility: Visual Web Service Client
Movie: http://digitforge.com/downloads/vwsoverview.wvx
On Mar 28, 6:58 pm, scott.iisyst...@gmail.com wrote:
> Hi,
>
[quoted text clipped - 96 lines]
> Thanks very much,
> Scott