Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a Web Reference in C# Visual Studio. When I build the project I get zwS_SQRT1 user control in my toolbox (it has an operation ZSqrt). I put it on the form and then

C#
zwS_SQRT1.Credentials = new System.Net.NetworkCredential("GORENMI1", "tlaxcala3");
si.durs.guediserr.ZSqrt x = new si.durs.guediserr.ZSqrt();
x.Number = 16;
si.durs.guediserr.ZSqrtResponse y = new si.durs.guediserr.ZSqrtResponse();
y = zwS_SQRT1.ZSqrt(x);
MessageBox.Show(y.Result.ToString());


Sometimes I get a result, but sometimes I get only the error message

The request was aborted: The request was canceled.

What am I doing wrong ?

The Error message is:

C#
System.Net.WebException was unhandled
  HResult=-2146233079
  Message=The request was aborted: The request was canceled.
  Source=System.Web.Services
  StackTrace:
       at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at WebService.si.durs.guediserr.ZWS_SQRT.ZSqrt(ZSqrt ZSqrt1) in D:\DURS\Kovačnica\WebService\Web References\si.durs.guediserr\Reference.cs:line 80
       at WebService.Form1.button1_Click(Object sender, EventArgs e) in D:\DURS\Kovačnica\WebService\Form1.cs:line 39
       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(IntPtr 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(Form mainForm)
       at WebService.Program.Main() in D:\DURS\Kovačnica\WebService\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:



Thanks in advance

Miran
Posted
Updated 1-Feb-15 23:58pm
v4
Comments
[no name] 2-Feb-15 5:08am    
What is the exact error you are getting with what input?
Sinisa Hajnal 2-Feb-15 6:02am    
Možda te muči Kova- č -nica u putanji? :)

Sorry, no idea except the obvious...is it timeout problem? Can you replicate when exactly you receive the result and when not? Meaning, is certain number always resulting in the cancelation? Is it type range problem (maybe it breaks when you enter too high a numbe)? Try with async await or wrap the operation in while (y.Result != null), maybe your msgbox triggers before the service returns the result?
Amoxtli 2-Feb-15 6:39am    
Thank you for your answer. The code

y = zwS_SQRT1.ZSqrt(x);
while (y == null)
{
y = zwS_SQRT1.ZSqrt(x);
}

does not help. But I found a line in Reference.cs:

// CODEGEN: The optional WSDL extension element 'Policy' from namespace 'http://schemas.xmlsoap.org/ws/2004/09/policy' was not handled.

I guess this could be a problem, but I don't know how to solve it.
Atish K. Singh 2-Feb-15 6:28am    
This is your inner exception right? If it is then please post the exact exception details.
Amoxtli 2-Feb-15 9:22am    
Exception details are:

System.Net.WebException was unhandled
HResult=-2146233079
Message=The request was aborted: The request was canceled.
Source=System.Web.Services
StackTrace:
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at WebService.si.durs.guediserr.ZWS_SQRT.ZSqrt(ZSqrt ZSqrt1) in D:\DURS\Kovačnica\WebService\Web References\si.durs.guediserr\Reference.cs:line 80
at WebService.Form1.button1_Click(Object sender, EventArgs e) in D:\DURS\Kovačnica\WebService\Form1.cs:line 39
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(IntPtr 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(Form mainForm)
at WebService.Program.Main() in D:\DURS\Kovačnica\WebService\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900