问题
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