Hosting a WCF(mex endpoint) service inside a windows service on windows 2008

亡梦爱人 提交于 2020-01-06 07:56:11

问题


I'm hosting a WCF service inside a windows hosted service.

When I start the WHS, I get the following error:


The ChannelDispatcher at 'net.tcp://mysecreturl/' with contract(s) '"IClass"' is unable to open its IChannelListener.

System.InvalidOperationException: A registration already exists for URI 'net.tcp://mysecreturl/Indexer/'.
   at System.ServiceModel.Channels.UriPrefixTable`1.RegisterUri(Uri uri, HostNameComparisonMode hostNameComparisonMode, TItem item)
   at System.ServiceModel.Channels.ConnectionOrientedTransportManager`1.Register(TransportChannelListener channelListener)
   at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
   at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
   at System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.TcpChannelListener`2.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)

   at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at VBoD.Search.WindowsServiceHost.WindowsServiceHost.OnStart(String[] args) in D:\......:line 29

System.ServiceModel

Are these somewhere in Windows or are they registered and unregistered when I start/stop the process?


回答1:


Use a diffeent endpoint for Mex. It probably needs a different port number from you net.tcp port as well. If your net.tcp port is 8000 then try

<endpoint address="net.tcp://mysecreturl:8001/Mex" 
          contract="IMetadataExchange" />


来源:https://stackoverflow.com/questions/1303414/hosting-a-wcfmex-endpoint-service-inside-a-windows-service-on-windows-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!