2013-12-16 13 views
6

ho visto già tali posti: wcf System.ServiceModel.AddressAlreadyInUseException, Windows Service hosted WCF over HTTPS, Getting AddressAlreadyInUseException after upgrading to .NET 4.5, nessuno di loro risolvere il mio problema. Ho diversi servizi wcf in .net 4.5. Tutti loro sono nella stessa Indirizzo, sto ricevendo questa eccezione nell'ospite servizio WCF: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 mia 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> 

ho già la porta riservata con questo comand:

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

E anche un certificato associato alla porta:

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

Avete bisogno di ulteriori informazioni?

+1

Dai un'occhiata a [TCPView] (http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx) per vedere se c'è già qualcosa in esecuzione su quella porta. – Stijn

+0

L'ho già fatto, non ho visto nulla con 443 in Local Port. –

+0

Non dovrebbe '' be ' invece? (Notare la rimozione del file .svc nell'indirizzo di base). Potresti avere un problema simile con 'ServicioPing'. Inoltre, se stai ospitando in IIS non è necessario specificare l'indirizzo di base: sarà la posizione del file .svc per il servizio. – Tim

risposta

4

Ho trovato che un'applicazione WCF (o piuttosto http.sys) può contenere un URL per un po 'di tempo dopo la sua chiusura. Se si tenta di riavviarlo immediatamente, è possibile ottenere il temuto "AddressAlreadyInUseException" perché l'istanza precedente dell'applicazione lo trattiene in qualche modo. Ho scoperto che se aspetto qualche minuto e riprovo, può funzionare.

2

Nel caso questo aiuti qualcuno. Ho avuto lo stesso problema durante il tentativo di ospitare un servizio wcf in un'applicazione console. Quello che ho fatto è stato aprire la proprietà della libreria del servizio wcf (Alt + Invio o clic destro-> Proprietà) quindi andare alla scheda Opzioni WCF nella finestra Proprietà e deselezionare "Avvia servizio host WCF quando esegui il debug di un altro progetto nella stessa soluzione". Allora il problema è risolto.

+0

Ho seguito lo stesso trucco per risolvere il problema, ma non sono riuscito a vedere il servizio WCF in esecuzione nella mia barra di stato in Windows 10 Home edition. Se pensi che manchi qualcosa. Lo apprezzerò molto. Grazie @ stt106 –

0

Ho avuto lo stesso problema.
non è riuscito a trovare nessun'altra app di ascolto su quella porta, non ha avuto alcun conflitto di sorta, eppure questo messaggio di errore non è andato via.
è successo subito dopo il servizio si è interrotto, e da allora non ho potuto richiamarlo di nuovo.
comunque, dopo il riavvio del PC tutto ha funzionato. oh beh ..