在 Windows Server 2003 上运行的 Windows 服务无法调用同一计算机上的 xml Web 服务

发布于 2024-08-03 01:01:10 字数 1557 浏览 6 评论 0原文

我的 Windows 2003 服务器上运行着一个 XML Web 服务。我有一个 Windows 服务在同一台机器上运行。我想从 Windows 服务调用 XML Web 服务。

这在我运行 Windows XP 的开发机器上运行良好。但是,当我尝试在 Windows Server 2003 机器上执行此操作时,它会超时并引发异常。我的 Windows 服务捕获异常并将其写入事件日志。这是错误在事件日志中显示的方式:

无法找到源 (myWS) 中事件 ID (0) 的描述。本地计算机可能没有必要的注册表信息或消息 DLL 文件来显示来自远程计算机的消息。您可以使用 /AUXSOURCE= 标志来检索此描述;有关详细信息,请参阅帮助和支持。以下信息为本次活动的一部分: MyWS 服务中出现异常:[System.Net.WebException: 无法连接到远程服务器 ---> System.Net.Sockets.SocketException:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立的连接失败[我的IP地址] 在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress 套接字地址) 在 System.Net.Sockets.Socket.InternalConnect(端点远程EP) 在 System.Net.ServicePoint.ConnectSocketInternal(布尔 connectFailure、Socket s4、Socket s6、Socket 和套接字、IPAddress 和地址、ConnectSocketState 状态、IAsyncResult asyncResult、Int32 超时、Exception 和异常) --- 内部异常堆栈跟踪结束 --- 在 System.Net.HttpWebRequest.GetRequestStream() 在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串方法名称,对象[]参数) 在 C:\Projects\Odyl\OdylUtilities\MyWS\TesterClient.cs 中的 TesterClient.Test() 处:第 30 行 在 C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs 中的 MyWS.MyWSWindowsService.DoMyWSService() 处:第 81 行 在 C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs 中的 MyWS.MyWSWindowsService.StartService():第 45 行]。

正如您所看到的,它在写入事件日志(所有 AUXSOURCE 内容)时遇到一些问题,但主要问题是它从 Web 服务收到超时错误。

不过,真正奇怪的是——从我的开发盒(运行 XP)中,我可以调用在我的 Windows 2003 Server 盒上运行的 Web 服务。这确实令人困惑——显然 Web 服务工作正常,但由于某种原因,Windows Server 2003 不允许您从同一台计算机调用 Web 服务!

有人能给我提示一下发生了什么事吗?

I have an XML web service running on my Windows 2003 server. I have a windows service running on the same machine. I want to call the XML web service from the windows service.

This works fine on my development machine, which is running Windows XP. However, when I try to do this on my Windows Server 2003 box, it times out and throws an exception. My windows service catches the exception and writes it to the eventlog. This is how the error shows up in the event log :

The description for Event ID ( 0 ) in Source ( myWS ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event:
Exception in MyWS service : [System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 [MY IP ADDRESS HERE]
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TesterClient.Test() in C:\Projects\Odyl\OdylUtilities\MyWS\TesterClient.cs:line 30
at MyWS.MyWSWindowsService.DoMyWSService() in C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs:line 81
at MyWS.MyWSWindowsService.StartService() in C:\Projects\Odyl\OdylUtilities\MyWS\MyWSWindowsService.cs:line 45].

As you can see, it has some problem with writing to the eventlog (all that AUXSOURCE stuff), but the main problem is that it's getting a timeout error from the web service.

Here's the truly odd thing, though -- from my dev box (running XP), I can call the web service that's running on my Windows 2003 Server box. This is really perplexing -- obviously the web service is working fine, but for some reason, Windows Server 2003 will not let you call a web service from the same machine!

Can anybody please give me a hint as to what's going on?

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

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

发布评论

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

评论(1

此生挚爱伱 2024-08-10 01:01:10

这听起来像是与您的 Win2K3 服务器相关的网络问题。网络配置阻止它访问给定位置的服务 URL。

解决此问题的最简单方法:通过 RDP 连接到 Win2K3 Server 桌面并打开 Web 浏览器以连接到 Web 服务。我希望你能得到一个暂停。

解决此问题的最简单方法是:如果存在本地运行的服务的 URL(即 localhost),请从您的服务尝试该 URL。否则,请准备好让网络管理员参与了解支持您要用于服务的 URL 路径所需的 DNS 设置。

This sounds like a networking issue related to your Win2K3 server. The network configuration is preventing it from accessing the service url at the given location.

Easiest way to troubleshoot this: RDP to the Win2K3 Server desktop and open up a web browser to connect to the web service. I expect you will get a timeout.

Easiest way to remedy this: if there is a URL to the service that works locally, i.e. localhost, try that from your service. Otherwise, be prepared to get your network administrator involved to understand the DNS settings necessary to support the URL path you want to use for your service.

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