The dreaded AddressAccessDeniedException

About six months ago, I made the switch from developing with the .NET framework on Windows XP to Windows Vista (My main development rig runs Windows Vista Business 64-bit which is rock solid, I use Virtual PC 2007 SP1 to run virtual machines for development, testing, trials, etc. I even have a openSuse VM for Mono work!). I was flying high with Vista Service Pack 1 installed on the development VM until I hit the dreaded AddressAccessDeniedException –

AddressAccessDeniedException in Visual Studio 2008

AddressAccessDeniedException in Visual Studio 2008

Fortunately, this was not the first time I encountered this exception. In the first major project where I developed a workflow-driven business layer exposed with the WCF WorkflowServiceHost, I spent about three hours fighting with the exception during a deployment drill, until I hit the cause of the issue and found a solution. Digging deep to find a nice solution, I initially tried using httpcfg.exe as outlined in this MSDN article but soon gave up.

Fast forward to present – I am using a console application to host a workflow which is exposed to clients using a WCF WorkflowServiceHost. I use WSHttpContextBinding as the binding for the endpoint. The console application runs well within Visual Studio 2008 when I use a Windows XP Service Pack 3 VM for testing. I encounter the exception when I attempt to run the same console application in Vista. I turned off UAC (Yes, you may ask me why do I use Vista then!), restarted Visual Studio and it was all good. Next, I turned on UAC, right-click on the Visual Studio 2008 shortcut, and select “Run as administrator”. The console application runs fine without any exceptions! I coudn’t justify myself running Visual Studio with elevated permissions in Windows Vista without finding a way to add the reserved HTTP namespace to the group of users my logged in account belongs to.

I refreshed my memory of an excellent tool that I used the last time I encountered the same exception during the deployment drill on a server running Windows Server 2003. This tool is called HttpNamespaceManager, developed and shared by Paul. This tool can be used to manage HTTP namespaces. It provides a user interface that is simple and easy to follow. When adding a reserved HTTP namespace to the list, use the string http://+:9000/ (This is only an example; I was using http://localhost:9000 to host the workflow) in the “Enter URL” popup, followed by “BUILTIN\Users” in the “Permissions” popup – “Group or User Names” section. After entering the users group, turn on the “GenericExecute” option. Close all the pop-up windows and try running the application. The exception does not appear again.

In summary, there are two (nice) ways to resolve the exception –

  • Run Visual Studio 2008 as administrator.
  • Run the HttpNamespaceManager tool and the HTTP namespace the group of users your user account belongs to.

I had hoped that with Visual Studio 2008 SP1 this issue will have been resolved. However, this is not the case. I am guessing this is perhaps the a requirement for Visual Studio 2008 – not to allow the user to access reserved HTTP namespaces unless explicit permission is granted.

Have a nice day!
Indy

Advertisements

Visual Studio 2008 SP1 & SQL Server 2008 released

Earlier this week, Microsoft announced the RTM of Visual Studio 2008 Service Pack 1 & SQL Server 2008. These are available for MSDN subscribers for download. SQL Server 2008 evaluation versions are available for a 180 day trial (The SQL Express Edition is freely available for download). Service pack 1 for Visual Studio 2008 and the .NET framework 3.5 is available here.

Some caution while installing the Visual Studio 2008 SP1 if you had the SP1 Beta installed. A cleanup utility is available here which removes any Visual Studio KBs installed. The readme file has some detailed information about installing the service pack.

So, whats new in these releases?

SQL Server 2008 adds enhancements to the database engine, new T-SQL programmability features, enhancements to Integration Services, Reporting & Analysis services have been rewritten & no longer require IIS, Powershell is now integrated and entirely new management feature [Performance Studio] has been added to monitor speed and efficiency of databases. Microsoft has also announced the availability of Beta exams on SQL Server 2008 (I’ll post about these exams later).

The Visual Studio & .NET framework service packs contain a number of enhancements targeted for developers, improving the productivity while using Visual Studio as well as ehancing several existing features in ASP.NET, WPF, and other technologies. Visual Studio (with SP1) now has better javascript intellisense support, support for classic ASP intellisense & support for refactoring WCF services in ASP.NET projects. ASP.NET enhancements include dynamic data, URL routing engine (used for MVC and dynamic data support) & AJAX script combining (asp:ScriptManager can now be configured to combin all the configured scripts & sent to the client as a single script). Several new windows forms controls including vector shapes and a datarepeater have been added. Windows Presentation Foundation has had several improvements and enhancements, detailed discussion of them should perhaps form the content of different post. Most notable amongst the WPF improvements include performance and data improvements (20-45% without any code changes – that’s very encouraging!), addition of shader effects, DirectX Interop [Dr. WPF has an article on Codeproject on this], etc. Visual Studio now supports navigation to definition of items declared in XAML.

.NET Framework 3.5 Enhancements Training Kit

The .NET framework 3.5 enhancements training kit contains material to help you understand and explore the new enhancements. This kit is available for download here. The kit is an enhacement to the very useful Visual Studio 2008 training kit.

I am excited like any other .NET developer about the release! I look forward to exploring the feature improvements and enhancements and blog about any interesting bits that I find useful to share.