DotNet, WCF

Resolve AddressAccessDeniedException: HTTP could not register URL http://+:80/ Error in WCF Service


I was facing one issue with hosting wcf service with httpbinding. I was getting below error message

"HTTP could not register URL http://+:8088/MarketService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."

It clearly says service host process does not have access rights to run on particular port. To resolve I run command

on command prompt.Note command prompt should be "Run as administrator".

netsh http add urlact url="http://+:8088/MarketService user=domain\userid

After this my service was running perfect.

Source code in which I was getting problem

using (var productHost = new ServiceHost(typeof(MarketDataProvider))) 
     { 
        ServiceEndpoint productEndpoint = 
		productHost.AddServiceEndpoint(typeof(IMarketDataProvider), 
		new NetTcpBinding(), "net.tcp://localhost:8000/MarketService"); 
        ServiceEndpoint producthttpEndpoint = 
		productHost.AddServiceEndpoint(typeof(IMarketDataProvider), 
		new BasicHttpBinding(), "http://localhost:8088/MarketService"); 
                productHost.Open(); 
     } 

Have fun with coding!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s