WCF and Publish Subscribe–A Full Example: Running the Client (Subscriber)
- WCF and Publish Subscribe– A Full Example: Introduction
- WCF Publish Subscribe–A Full Example – The Service Side Part 1 (Interface)
- WCF Publish Subscribe– A Full Example: The Service Side Part 2 (Implementation)
- WCF and Publish Subscribe–A Full Example: The Event Generator
- WCF and Publish Subscribe–A Full Example: Client Code
- WCF and Publish Subscribe–A Full Example: Running the Client (Subscriber)
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.
2. Launch HttpNamespaces exe – Click Add – Paste the copied URL into the URL textbox that appears.
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.
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).
Good and excellent. Praises. My question, I need to make host my service on Win
Hi. Great post! I downloaded your solution, run it and something went wrong. There’s an error: “Source file ‘WCFPublishService\Consoleapplication1\Properies\AssemblyInfo.cs’ could not be opened(‘Unspecified error’)”
Im new in WCF as well as in Publish-Subcribe framework. I’d like your example be my guide in this. Please help. Thank you.
Delete AssemblyInfo file from properties in each of ur project and recreate or run without it it it.
Thanks for pointing that out
hi,
i couldnt find the souce code to download. Does it still available? I need to implement pub/sub in my project.
Source code should be on the last post (number 6).
Also, I would recommend trying another post – just search for IObservable on the website – you should see a post describing two new interfaces in c# for pub-sub.
The download should be available now. Thanks for pointing it out.
Hello
Thanks for this nice article.
I tried to have a look with the source code associated and I get something strange
I execute the wcf from vs and I run from the command line the subscriber.
Do you have any ideas why when I tried to execute this example I egt the following error :
Unhandled Exception: System.ServiceModel.AddressAlreadyInUseException: HTTP coul
d not register URL http://+:26836/myClienta1c0ab96-20ab-40bc-958a-6acf5794c8b2/
because TCP port 26836 is being used by another application. —> System.Net.Htt
pListenerException: The process cannot access the file because it is being used
by another process
at System.Net.HttpListener.AddAllPrefixes()
Everything seems ok but I dont know what I do wrong on my usage.
Thanks by advance
To overcome that error, try the suggestions here
https://www.anujvarma.com/wcf-and-publish-subscribea-full-example-running-the-client-subscriber/
I have retest with your suggestion but I till having the issue ( and different from the page)
I execute the service first on port 26836
I try to subscribe to the service using the subscribe project and I still having an issue coming : port already opened
the error came with folling exception
System.ServiceModel.AddressAlreadyInUseException: