Category Archives: Power User

Update a Word Document to the Word 2013 Style (aka Template)

This has been annoying me for ages as I have a lot of documents written in the default Word 2007/2010 template and the Word 2013 default styles look a lot nicer.

To change the ‘template’ (it’s not really a template any more it’s now a ‘Style Set’):

  1. Open the document in Word 2013
  2. Save As .docx
  3. Click on the Design tab
  4. Click on the More button of the Style Sets toolbar
  5. Click ‘Reset to the Default Style Set’
  6. You’re done

Resolving the dreaded System.ServiceModel.AddressAccessDeniedException error

I had a complex WCF service based solution working on my development PC but due to a problem when installing Windows 8.1 I had to ‘Refresh’ my PC which basically means reinstalling Windows, losing all my applications, but not my documents or data. So I had a few days of sorting out Windows, reinstalling apps and trying to get all my settings back to just the way they were before.

Now that I’ve reinstalled Visual Studio 2012 my project no longer functions correctly. When I debug a unit test the WCF Service Host displays an error:

Please try changing the HTTP port to 8733 or running as Administrator.
System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8732/Design_Time_Addresses/MyWCFService/Name/. 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

Apparently the usual solution to this is to run Visual Studio as administrator. However I’m unable to do that as the architecture we use at work requires us to reference DLLs on a network drive and network drives cannot be accessed when you run a program as administrator (aka elevated).

The other alternative of changing the port to 8733 would require editing every service, re-referencing them and then rebuilding the solution and hoping that it works (unlikely).

After a bit of digging around and research I found out that recent versions of Windows enforce security settings that prevent you from listening to any ports. I’m assuming that when Visual Studio is installed it reserves a port for it’s own use so that you can host and thus debug web services. This was the localhost:8732 port on my development machine but with reinstalling Visual studio it is now localhost:8733, unfortunately all my app.config files in the solution point to port 8732.

However this can be fixed!

Run an elevated command prompt and execute ‘netsh http show urlacl’. This displays the list of reserved ports amongst which I found this:

Reserved URL            : http://+:8733/Design_Time_Addresses/
User: NT AUTHORITY\INTERACTIVE

Which, I’m assuming, is the entry added when Visual Studio was installed.

Executing the following command reserves the 8732 url/port:

‘netsh http add urlacl url=http://+:8732/ user=WORK\Robin’

Restart Visual Studio and all of a sudden my solution works again.

Handy Tip for Virtual Machines

When I’m booting up a virtual machine on my PC I always have to dig into the network details or run ipconfig in  order to determine the IP Address before I can use remote desktop. To save one of those steps you can run bginfo from the startup folder to get it to automatically write the IP Address and other details to the desktop background:

http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx

and

http://windows.microsoft.com/en-us/windows/run-program-automatically-windows-starts

Posting Source Code in WordPress

This is so simple that it’s easily overlooked. Wrap your source code in [sourcecode] tags. Add a language element for specific styles.

Reference: http://en.support.wordpress.com/code/posting-source-code/

Test a database connection

  1. Create a file called [SOMETHING].udl
  2. Double click to run it
  3. Enter connection details in the dialog
  4. Click ‘Test Connection’

The go here: http://support.microsoft.com/kb/328306