Thursday, December 18, 2008

Azure Services Kit - Exercise 2 (IntroServiceBus)

I have recently been evaluating the Azure Services Kit and ran across an error that I figured I would post in case anyone is looking for a solution.

The error occurs in Exercise #2 when trying to initialize the Server project to listen for requests through the .Net Services Service Bus. I would imagine that this error applies more so to IIS and WCF than the actual Service Bus.

Error
System.ServiceModel.AddressAccessDeniedException was unhandled Message="HTTP could not register URL http://+:80/services/My-Solution-Name/EchoService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)." Source="System.ServiceModel" StackTrace: 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.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) 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 D:\Development\AzureServicesKit\Labs\IntroServiceBus\Ex02-BindingsConnectionModesSample\begin\Service\Program.cs:line 34 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Net.HttpListenerException Message="Access is denied" Source="System" ErrorCode=5 NativeErrorCode=5 StackTrace: at System.Net.HttpListener.AddAll() at System.Net.HttpListener.Start() at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() InnerException:

Solution
The solution itself can be found in the link that is provided ( http://go.microsoft.com/fwlink/?LinkId=70353) ...I know what a bonus; an error message that actually points you in the right direction to a solution.

The description of the error is not all that useful, but does cover some scenarios:
Using Windows Communication Foundation (WCF) over HTTP either requires the use of a host, such as Internet Information Services (IIS), or manual configuration of the HTTP settings through the HTTP Server API. This document describes manually configuring WCF when using HTTP and HTTPS.

In order to actually solve the problem, I ran this command on my Vista machine:

netsh http add urlacl url=http://+:80/services/My-Solution-Name/EchoService/ user=domain\user

Note:
  • "My-Solution-Name" is where I inserted my Azure Solution name. You would enter yours in this place holder.
  • If your machine is not part of a Domain, just use the local machine name instead of Domain

Now that I have some spare time, I plan on spending some more time with Azure and more specifically .Net Services. Hopefully, I will have some interesting posts regarding these technologies.

3 comments:

prashant phalle said...

Hi,
I deployed the WCF service on cloud, and trying to run it then I get error,
HTTP could not register URL http://+:80/CalculatorService.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

The workaround suggested did not work for me..Any other suggestion ?

Prashant

Kent Weare said...

Hi Prashant....have you checked out the comments section of this post:

http://blogs.msdn.com/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx#comments

Are you running your Visual Studio as an Administrator? Are you on Vista?

prashant phalle said...

I went through the comments..but it is does not prove useful for me. I gave the stack trace here for your reference. I appreciate if you can figure out the problem,
HTTP could not register URL http://+:80/CalculatorService.svc/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

-- 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.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.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionServerSettings.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.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 ACSCloud_WebRole._Default.OpenHost() in C:\Program Files\Microsoft .NET Services SDK (March 2009 CTP)\Samples\AccessControl\ACSCloud\ACSCloud_WebRole\Default.aspx.cs:line 104

I tried the netsh command but it didnt work.