This entry is part 6 of 6 in the series WCF Publish Subscribe - A Full Example in C#, Step by Step

Now that all the pieces are in place, we are ready to run our client program.  The first error I encountered was:

AddressAccessDeniedException: HTTP could not register URL http://+:8080/

Step 1 – On running the Subscriber project, you may get an AddressAccessDenied exception (especially if you are on Windows Vista). To work around this error, launch a command prompt as administrator (right click and Run As Admin). In the command prompt, type :

netsh http add urlacl url=http://+:26836/ user=DOMAIN\UserName (do you need to lookup your username or your domain name ?).

Step 2 – What I needed was to provide local access to the address on which the client was running (the callback address). A tool called HttpNamespaceManager allowed me to grant that access to the http address+port that I needed. (See http://blogs.msdn.com/b/paulwh/archive/2007/05/04/addressaccessdeniedexception-http-could-not-register-url-http-8080.aspx for details). A quick summary of how to work around this error is given below:

1. Copy the http namespace from your DOS prompt.

dos_copy_url

2. Launch HttpNamespaces exe – Click Add – Paste the copied URL into the URL textbox that appears.

add_http_namespace

3. Grant access to the following USER GROUPS – USERS and LOCAL SERVICE. Once you add these groups, select them and check the ‘GenericExecute’ box as shown below.

USERS_group   execute_perms_users_group

Summary

Once you get past the Unhandled Exception: System.ServiceModel.AddressAccessDeniedException (using the steps above), you should be able to run the Subscriber console app (make sure you run the service first by starting the MagazineService project as shown below. You CAN run both from the same Visual Studio Solution Explorer).

launch_service

 

download full source codeWCFPublishSubscribe.zip

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.


Series NavigationWCF and Publish Subscribe–A Full Example: Client Code