Tech Talk A software developer on all things tech, and then some

25Aug/120

HTTP could not register URL [url]. Your process does not have access rights to this namespace

I was trying to build a project that I inherited (ASP C# ~.Net4) and I got the following error

Please try changing the HTTP port to 8732 or running as Administrator.
System.ServiceModel.AddressAccessDeniedException: HTTP could not register [url]. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

...

System.Net.HttpListenerException (0x80004005): Access is denied
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()

All the issue was is that Visual Studio could not access certain files since it does not have administrator access. Run as administrator, and you should no longer have a problem. Also go to properties (Of Visual Studio) and select the run as administrator for future reference so you don't run into the issue again.

  • To run as an administrator, right click Visual Studio and select Run as Administrator from the context menu.
  • To run as administrator all the time, right click Visual Studio, then go to properties in the context menu
    • Got to the compatibility tab, then select Run this program as an administrator.

 

 

29Nov/110

Error While Sending a Class Collection Over a WCF Service

I had spent a great while debugging an operation which returned a collection an entity object. However, I had a bug in my code and I could not find what was causing it. I was given the following message over, and over, and over.

The socket connection was aborted. This could be caused by an error processing your message
or a receive timeout being exceeded by the remote host, or an underlying network resource issue.
Local socket timeout was '00:00:59.4260000'."}

28Nov/110

Including Exception Details in WCF (IncludeExceptionDetailInFaults)

Sometimes when you receive an exception when debugging a WCF service, you receive the following message :

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

What this is asking you to do is to find your Behaviors section and add the following line.

<serviceDebug includeExceptionDetailInFaults="true" />

To find this section, look in your App.config in your server application. Then find the section which has the behaviors tag. Find the behavior for your application, then add the line above. It should resemble the following :

<behavior name="mexbehavior">
   <serviceMetadata httpGetEnabled="True" httpGetUrl="http://ApplicationURL"/>
   <serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
   
%d bloggers like this: