2013-12-16 2 views
6

Я уже просмотрел эти сообщения: wcf System.ServiceModel.AddressAlreadyInUseException, Windows Service hosted WCF over HTTPS, Getting AddressAlreadyInUseException after upgrading to .NET 4.5, никто из них не решить мою проблему. У меня есть несколько wcf-сервисов в .net 4.5. Все они находятся в том же Послании, i'm получаю это исключение в хост службы WCF:ФОС AddressAlreadyInUseException

System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL https://+:443/mafawcf01/ServicioAddin.svc/ because TCP port 443 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 
    at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener) 
    at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) 
    at System.ServiceModel.Channels.HttpChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.DatagramChannelDemuxer`2.OnOuterListenerOpen(ChannelDemuxerFilter filter, IChannelListener listener, TimeSpan timeout) 
    at System.ServiceModel.Channels.SingletonChannelListener`3.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(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 System.ServiceModel.Security.SecuritySessionSecurityTokenAuthenticator.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityUtils.OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionServerSettings.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Security.SecurityListenerSettingsLifetimeManager.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.SecurityChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 
    at System.ServiceModel.Channels.DelegatingChannelListener`1.OnOpen(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Open(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 Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info) 
System.Net.HttpListenerException (0x80004005): The process cannot access the file because it is being used by another process 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() 

Here's мой app.congif:

<host> 
     <baseAddresses> 
     <add baseAddress="https://localhost:443/mafawcf01/ServicioAddin.svc"/> 
     </baseAddresses> 
    </host> 
    </service> 
    <service name="mafawcf01.ServicioPing" behaviorConfiguration="mafawcf01.ServicioPingBehavior"> 
    <endpoint address="" 
       binding="basicHttpBinding" 
       bindingConfiguration="secureHttpBinding" 
       contract="mafawcf01.IServicioPing"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://localhost:443/mafawcf01/ServicioPing.svc" /> 
     </baseAddresses> 
    </host> 
    </service> 
    <service behaviorConfiguration="mafawcf01.Service1Behavior" name="mafawcf01.ServicioCargue"> 
    <endpoint address="https://localhost:443/MafaWCF01/ServicioCargue.svc" 
     binding="customBinding" bindingConfiguration="myCustomHttpBinding" 
     contract="mafawcf01.IServicioCargue" /> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://localhost:443/MafaWCF01/ServicioCargue/" /> 
     </baseAddresses> 
    </host> 
    </service> 
    <service behaviorConfiguration="mafawcf01.Service1Behavior" name="mafawcf01.ServicioValidacionMultiple"> 
    <endpoint address="https://localhost:443/MafaWCF01/ServicioValidacionMultiple.svc" 
     binding="customBinding" bindingConfiguration="transporteSeguro" 
     contract="mafawcf01.IServicioValidacionMultiple" /> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://localhost:443/MafaWCF01/ServicioValidacionMultiple/" /> 
     </baseAddresses> 
    </host> 

Я уже порт зарезервирован с это COMAND:

netsh http add urlacl url=https://+:443/MafaWCF01 

А также сертификат, связанный с порт:

netsh http add sslcert ipport=0.0.0.0:443 certhash={some cert hash} appid={some appid} 

Вам нужна дополнительная информация?

+1

Посмотрите с помощью [TCPView] (http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx), чтобы узнать, есть ли что-либо, уже запущенное на этом порту. – Stijn

+0

Я уже делал, ничего не видел с 443 в местном порту. –

+0

Не следует '<добавлять baseAddress =" https: // localhost: 443/mafawcf01/ServicioAddin.svc "/>' be '<добавить baseAddress =" https: // localhost: 443/mafawcf01/"/> вместо этого? (Обратите внимание на удаление файла .svc в базовом адресе). У вас может быть аналогичная проблема с 'ServicioPing'. Кроме того, если вы размещаете в IIS, вам не нужно указывать базовый адрес - это будет файл .svc для службы. – Tim

ответ

4

Я обнаружил, что приложение WCF (или, скорее, http.sys) может удерживать URL-адрес на некоторое время после его закрытия. Если вы попытаетесь перезапустить его немедленно, вы можете получить страшное «AddressAlreadyInUseException», потому что предыдущий экземпляр приложения каким-то образом удерживает его. Я обнаружил, что если я подожду несколько минут и повторю попытку, это может сработать.

2

В случае, если это кому-то поможет. У меня была такая же проблема при попытке разместить службу wcf в консольном приложении. То, что я сделал, было открыто. Свойство библиотеки служебных данных wcf (Alt + Enter или right click-> Property), затем перейдите на вкладку «Параметры WCF» в окне «Свойства» и отключите «Запустить хост службы WCF при отладке другого проекта в том же решении». Тогда проблема исправлена.

+0

Я выполнил тот же трюк, который решил проблему, но я не смог увидеть, что служба WCF работает в моей строке состояния в Windows 10 Home edition. Если вы думаете, что чего-то не хватает. Я буду очень признателен. Спасибо @ stt106 –

0

У меня была та же проблема.
не смог найти ни одного другого приложения, прослушивающего этот порт, не имел никакого конфликта, но это сообщение об ошибке не покидало.
Это случилось сразу после того, как служба рухнула, и с тех пор я не мог ее снова поднять.
в любом случае, после перезагрузки ПК все сработало. oh well ..

Смежные вопросы