Я выполняю сервис WCF из exe (для отладки, это будет перемещено в службу окон при развертывании) я получил один сервис, хорошо работающий в нем однако, когда я выполняю второй сервис, я получаю исключение
System.InvalidOperationException was unhandled
Message=The ChannelDispatcher at 'http://backupsvr:8082/' with contract(s) '"IHttpGetHelpPageAndMetadataContract"' is unable to open its IChannelListener.
Source=System.ServiceModel
StackTrace:
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 System.ServiceModel.Channels.CommunicationObject.Open()
at Service.Program.Main() in E:\Visual Studio 2010\Projects\Contract Flow Suite\Service\Program.cs:line 30
InnerException: System.InvalidOperationException
Message=A registration already exists for URI 'http://backupsvr:8082/'.
Source=System.ServiceModel
StackTrace:
at System.ServiceModel.Channels.UriPrefixTable`1.RegisterUri(Uri uri, HostNameComparisonMode hostNameComparisonMode, TItem item)
at System.ServiceModel.Channels.HttpTransportManager.Register(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
InnerException:
вот код, который называет его.
using(ServiceHost hostRemoteUserManager = new ServiceHost(typeof(RemoteUserManager)))
using(ServiceHost hostDatabaseManagement = new ServiceHost(typeof(DatabaseManagement)))
try
{
// Open the ServiceHost to start listening for messages.
hostRemoteUserManager.Open();
hostDatabaseManagement.Open(); //Exception on this line.
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press to terminate service.");
Console.ReadLine();
// Close the ServiceHost.
hostRemoteUserManager.Close();
hostDatabaseManagement.Close();
}
И вот мой файл App.config, я использовал Сервисный Редактор конфигураций в Visual Studio 2010 для создания его.
REMOVED
Что делает я должен измениться в своем файле App.config для разрешения больше чем одного сервиса кроме выполнения их на различных портах. Я хотел бы запросить http://backupsvr:8082/ и иметь его, перечисляют все сервисы, доступные, когда я использую инструмент "Add Service Refrence".
ОБНОВЛЕНИЕ-
Я сделал предложение Igor, оно теперь работает на том же порте однако в Добавить сервисном ссылочном диалоговом окне, которое я все еще должен ввести в http://backupsvr:8082/RemoteUserManager и http://backupsvr:8082/DatabaseManagement insted всего одного http://backupsvr:8082/. Я не знаю, возможно ли то, что я желаю, кажется, что это - способ, которым это должно быть по тому, как диалоговое окно разработано. вот копия обновления моего app.config файла
использование для первой службы
<baseAddresses>
<add baseAddress="net.tcp://backupsvr:8082/IRemoteUserManager"/>
</baseAddresses>
использование для второй службы
<baseAddresses>
<add baseAddress="net.tcp://backupsvr:8082/IDatabaseManagement"/>
</baseAddresses>
адреса должны быть уникальными