Windows服务问题

时间:2011-08-26 14:45:07

标签: wcf service

我有wcf服务,每分钟检查%programdata%/ MYAPP文件夹,并将此目录中的所有xml文件发送到sharepoint站点。但我对此服务有一些问题(来自事件查看器的描述):

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://localhost:44300/DataService.svc 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: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:44300
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   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(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IncidentReportAgent.IRS3DataService.IDataService.UploadReport(Stream reportBinary)
   at IncidentReportAgent.IncidentReportAgentService.ProcessFile(String fileName)

仅当我从VS2010开始服务时才进行服务工作(project-> debug->启动新实例)。

2 个答案:

答案 0 :(得分:1)

“只有当我从VS2010开始服务(项目 - > debug->启动新实例)时,服务才能正常工作。”

听起来好像你实际上没有在Visual Studio之外的任何地方托管过该服务。根据它正在寻找的服务端点地址,看起来您的意图是在IIS下托管。

您需要使用服务的虚拟目录/应用程序配置IIS。

How to: Host a WCF Service in IIS

答案 1 :(得分:0)

错误消息表明它无法在https://localhost:44300/DataService.svc

找到该服务

这可能是VS运行服务的地址。

如果您已在其他任何地方安装了该服务,例如在端口80上,则客户端无法找到它,因为客户端正在查看44300端口。