Monday, February 28, 2011

Address Access Denied Exception

Problem
I was developing WCF application where I had to use basic http binding, I was trying to host it in the console application and for some reason I was getting Address Access Denied Exception.

Impact
Application won't run.

Solution
After much of research I found out that since the release of vista, windows has implemented new security feature and because of that most people won't be running with Administrator privileges and since http protocol requires the Admin rights so application won't run. Now to solve this issue we need to do 2 things

1. Run netsh command on console.
Go to start, enter netsh, windows will find the netsh.exe file, right click and choose run as admin. Console will run the utility. and we will get the netsh>
now enter the following command

netsh>http add urlacl url=http://localhost:8080/test user=FARAZ-PC/faraz and enter.

now user name should be the name of your machine, in my case it was faraz-PC. after running the command you should get some message telling you that http has been added.

2. Restart visual studio and start it as Administrator.

and run your application again and it should now work.

5 comments:

  1. Thanks for post ,it helped me a lot

    ReplyDelete
  2. what security issue has been implemented from vista? i cannot listen on any port without admin privilages? if it is true, how does my all application works without the admin privilages?

    ReplyDelete
  3. Address Access Denied Exception is mainly come in WCF service access
    WCF Online Training
    WCF Training

    ReplyDelete