【问题标题】:Error while running a windows service运行 Windows 服务时出错
【发布时间】:2011-09-08 06:18:24
【问题描述】:

我创建了一个 Windows 服务,并将它安装在我的 PC 上。当我从控制面板单击启动服务时。然后我收到以下错误消息。

可能出了什么问题?

事件查看器中的错误消息:

 Description:
Service cannot be started. System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://www.domain.in/MyServ.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
  at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---

Server stack trace: 
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChann...
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
<Provider Name="Service1" />
<EventID Qualifiers="0">0</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2011-06-04T05:21:43.000000000Z" />
<EventRecordID>38441</EventRecordID>
<Channel>Application</Channel>
<Computer>TaxSmart30</Computer>
<Security />
</System>
<EventData>
        <Data>Service cannot be started. System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://www.mydomain.com/MyServ.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---&gt; System.Net.WebException: The remote server returned an error: (404) Not Found.
 at System.Net.HttpWebRequest.GetResponse()
  at     System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
  --- End of inner exception stack trace ---

Server stack trace: 
  at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChann...</Data>
 </EventData>
 </Event>

【问题讨论】:

  • 那么您是否查看了错误消息中的建议?这个网址好像不正确...
  • @Jon Skeet:非常感谢。是的,我更改了 URL,这个问题得到了解决。但是,此 Windows 服务仅在我将它安装在本地 PC 上时才有效,当我尝试在我的虚拟专用服务器上安装和运行它时它不起作用。有什么问题?
  • 你说更改 URL 解决了一个问题,所以我猜你现在遇到了一个 不同 问题 - 但我们不知道那是什么。跨度>
  • @Jon Skeet:我正面临这个问题。我以前发布过这个问题。请参阅链接stackoverflow.com/questions/6201631/…。有什么问题?
  • 我对另一个问题的答案没有什么要补充的。在这里讨论这个问题没有意义。

标签: .net .net-3.5 service windows-services


【解决方案1】:

确保您运行服务的系统可以看到端点(asmx 地址)。我自己试过这个地址,它可以工作(我希望这是通过某种方式验证的)。我猜这可能是运行该服务的服务器的防火墙问题或连接问题(假设您可以确认该服务在其他计算机上有效)。

尝试 ping dns 记录以确认可以到达端点,并尝试将端点地址复制并粘贴到浏览器中(从有问题的服务器),看看是否有效。

【讨论】:

  • 否,此 Windows 服务在安装在我的本地 PC 上时可以正常工作,但在安装在虚拟专用服务器上时无法正常工作。
  • 您可以参考这个问题来准确了解我在专用服务器上运行相同服务时遇到的错误。请参阅此链接stackoverflow.com/questions/6201631/…。如果您能提供帮助,那就太好了。
  • @PARTH 因为它在您的 PC 上运行良好,所以我猜测仍然是连接问题,例如,专用服务器无法看到端点地址。如果您能够远程访问服务器,我强烈建议您尝试从服务器本身浏览到此端点。
猜你喜欢
  • 1970-01-01
  • 2017-10-10
  • 1970-01-01
  • 2021-08-07
  • 1970-01-01
  • 2011-09-06
  • 1970-01-01
  • 2014-10-31
  • 1970-01-01
相关资源
最近更新 更多