Question

I've got the following EndpointConfig.cs

public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
    public void Init()
    {
        Configure
            .With(GetAllAssemblies())
            .XmlSerializer()
            .UseTransport<SqlServer>()
            .DefaultBuilder()
            .UseNHibernateSubscriptionPersister()
            .UseNHibernateTimeoutPersister()
            .UseNHibernateSagaPersister()
            .UseNHibernateGatewayPersister()
            .UnicastBus()
            .PurgeOnStartup(false);
    }
}

And I'm getting the following exception:

2013-10-09 16:15:40,780 [16] ERROR NServiceBus.Satellites.SatelliteLauncher [(null)] <(null)> - Satellite NServiceBus.Gateway.Receiving.GatewayReceiver, NServiceBus.Core, Version=4.0.0.0, Culture=neutral,     PublicKeyToken=9fc386479f8a226c
System.Exception: Failed to start listener for http://localhost/NserviceBus/ make sure that you have admin privileges ---> 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 NServiceBus.Gateway.Channels.Http.HttpChannelReceiver.Start(String address, Int32 numWorkerThreads) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Gateway\Channels\Http\HttpChannelReceiver.cs:line 36
    --- End of inner exception stack trace ---
    at NServiceBus.Gateway.Channels.Http.HttpChannelReceiver.Start(String address, Int32 numWorkerThreads) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Gateway\Channels\Http\HttpChannelReceiver.cs:line 40
    at NServiceBus.Gateway.Receiving.IdempotentChannelReceiver.Start(Channel channel, Int32 numWorkerThreads) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Gateway\Receiving\IdempotentChannelReceiver.cs:line 34
    at NServiceBus.Gateway.Receiving.GatewayReceiver.Start() in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Gateway\Receiving\GatewayReceiver.cs:line 71
    at NServiceBus.Satellites.SatelliteLauncher.StartSatellite(SatelliteContext ctx) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Satellites\SatelliteLauncher.cs:line 107

Any ideas?

Thanks

Was it helpful?

Solution

Did you mean to enable the gateway component?
If not, remove the .UseNHibernateGatewayPersister()

The underlying issue has nothing to do with NServiceBus specifically. The account you're running Visual Studio under doesn't have the rights to reserve a HTTP/S port. The same thing happens when self hosting WCF endpoints.

More information on MSDN

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top