通过 WLAN 进行的首次 Web 服务调用在 Wince 5.0 中引发异常

发布于 2024-08-28 06:49:44 字数 1275 浏览 4 评论 0原文

我开发了一个在 Wince 5.0 设备上运行的应用程序。 我使用 WLAN 进行 Web 服务调用。如果应用程序服务器位于 LAN 中,则应用程序可以正常工作。 在另一种情况下,它仅在应用程序第一次尝试与应用程序服务器通信时引发异常。如果应用程序第二次启动,则不会引发任何异常。

堆栈跟踪:

2010 年 4 月 13 日星期二 - 上午 10:03:04: 无法连接到远程服务器 在 System.Net.HttpWebRequest.finishGetResponse() 在 System.Net.HttpWebRequest.GetResponse() 在 System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest 请求) 在 System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest 请求) 在System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(字符串方法名称,对象[]参数,WebClientAsyncResult asyncResult) 在Aarya.Service.MIDServiceProxy.ManagementService.MIDAuthenticateLoginandRole(字符串sUsername,字符串sPassword) 在Aarya.Modules.MID.ProxyWrapper.ManagementServiceWrapper.MIDAuthenticateLoginandRole(字符串sUsername,字符串sPassword) 在Aarya.MID.AuthenticateManager.Logon(字符串登录名,字符串密码) at Aarya.MID.Shell.PerformAsyncLogin()


连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机未能响应 在 System.Net.Sockets.Socket.ConnectNoCheck(EndPoint RemoteEP) 在 System.Net.Sockets.Socket.Connect(端点远程EP) 在 System.Net.Connection.doConnect(IPEndPoint ep) 在 System.Net.Connection.connect(对象被忽略) 在 System.Threading.ThreadPool.WorkItem.doWork(Object o) 在 System.Threading.Timer.ring()

I have developed a application that run on a device with Wince 5.0.
I make web service calls using WLAN. The application works fine if the app server is with the LAN.
In the other case, it raises a exception only for the first time when the application tries to communicate with the appserver. If the application is launched for the second time it does not raise any exception.

The stack trace:

Tuesday, April 13, 2010 - 10:03:04 AM:
Unable to connect to the remote server
at System.Net.HttpWebRequest.finishGetResponse()
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
at Aarya.Service.MIDServiceProxy.ManagementService.MIDAuthenticateLoginandRole(String sUsername, String sPassword)
at Aarya.Modules.MID.ProxyWrapper.ManagementServiceWrapper.MIDAuthenticateLoginandRole(String sUsername, String sPassword)
at Aarya.MID.AuthenticateManager.Logon(String loginName, String password)
at Aarya.MID.Shell.PerformAsyncLogin()


A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.ConnectNoCheck(EndPoint remoteEP)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Net.Connection.doConnect(IPEndPoint ep)
at System.Net.Connection.connect(Object ignored)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新雨望断虹 2024-09-04 06:49:44

我的猜测是,第一次启动时您没有网络连接。然后,您的 Web 服务调用会向下调用连接管理器,连接管理器随后会启动无线电、联系 DHCP 服务器、获取地址,然后创建网络连接。

所有这些过程可能花费的时间太长,并且您的应用程序超时。进行第一次调用后,连接管理器会将该连接保持打开状态一段时间,并且您的第二次运行将使用该现有连接,因此它会成功。

无论如何,您的应用程序都需要处理超时(如果网络超出范围或无法访问怎么办),因此无论如何,正确的情况处理都应该解决这个问题。

My guess is that the first time it is launched you don't have a network connection. Your web service call then calls down into connection manager, which then powers up the radio, contacts the DHCP server, gets an address, then creates the network connection.

All of this process is probably taking too long and your app time's out. Once you've made the first call, Connection Manager keeps that connection open for a while and your second run uses that existing connection, so it succeeds.

Your app needs to be handling timeouts anyway (what if the network is out of range or unreachable), so proper situation handling should take care of this anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文