Monday, November 29, 2010

How to route your wcf service through your web proxy

This post just shows you a simple way to allow you allow your client applications connect to your wcf service through a proxy.

Lets look at the binding element for a simple service

<wsdualhttpbinding>
                <binding bypassproxyonlocal="false" clientbaseaddress="http://localhost:8188/clientCallback" closetimeout="00:01:00" hostnamecomparisonmode="StrongWildcard" maxbufferpoolsize="524288" maxreceivedmessagesize="265536" messageencoding="Text" name="WSDualHttpBinding_IMainService" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" textencoding="utf-8" transactionflow="false" usedefaultwebproxy="false">
<readerQuotas maxDepth="32" maxStringContentLength="18192" maxArrayLength="116384"
                        maxBytesPerRead="44096" maxNameTableCharCount="16384" />
<reliableSession ordered="false" inactivityTimeout="05:10:00" />
</binding>

</wsdualhttpbinding>

Notice that the useDefaultWebProxy property is set to false so as to allow the wcf proxy to use whichever proxy you now set. To allow your connection to go through a service all you have to do is add a proxyAddress property to your binding, so it becomes

<wsdualhttpbinding>
    <binding bypassproxyonlocal="false clientbaseaddress="http://localhost:8188/clientCallback"
 closetimeout="00:01:00"
 hostnamecomparisonmode="StrongWildcard"
 maxbufferpoolsize="524288"
 maxreceivedmessagesize="265536"
 messageencoding="Text" name="WSDualHttpBinding_IMainService"
 opentimeout="00:01:00" receivetimeout="00:10:00"
 sendtimeout="00:01:00" textencoding="utf-8" transactionflow="false"
 usedefaultwebproxy="false" proxyaddress="http://192.168.0.1:3028">
<readerQuotas maxDepth="32" maxStringContentLength="18192" maxArrayLength="116384"
                        maxBytesPerRead="44096" maxNameTableCharCount="16384" />
<reliableSession ordered="false" inactivityTimeout="05:10:00" />
</binding>

</wsdualhttpbinding>


but now what you just have is a service with a static proxy address. but lets say you want to do something fancy like let the user set and change his proxy, then you can just programmatically get acces to this binding and change the proxy address to whatever the user inputted.

you do this by

        WSDualHttpBinding binding = new WSDualHttpBinding("WSDualHttpBinding_IMainService");
        binding.ProxyAddress = new Uri(newProxyAddress);

where "WSDualHttpBinding_IMainService" is the name of your binding from your config file. Also newProxyAddress is the proxy address the user entered.

Lastly, remember that WCF has several bindings, not all bindings support a proxy, but your http binding types all allow proxies. So have fun using this.

P.S. if your proxy requires username and password, then check out this Link

Thursday, June 3, 2010

Configuring WSDualHttpBinding on Windows 7

This is a follow-up to Wenlong Dong'g blog, How to use WSDualHttpBinding for Hosted Services .


In an Internet scenario valid HTTP requests and responses only travel in one direction, HTTP is designed as a one-way protocol. When using the WSDualHttpBinding WCF therefore creates a seperate HTTP channel for callbacks.


To enable the service callback, you have to add the clientbase address as mentioned by wenlong.
But then you also have to register the address namespace, in windows xp and server 2003,you will have had to use the httpcfg utility, but in recent versions of windows you have to use netsh as shown below


netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user

e.g netsh http add urlacl url=http://+:2040/clientbaseaddress user=Users

i hope this helps

Monday, March 30, 2009

Some Fun Robots to Play with

Some robots you can use for your research


  • Alpha Rex
    See More...
















  • WowWee Rovio
    Conscious Robots - Monday, 30 March 2009







  • Aldebaran NAO
    Conscious Robots - Monday, 30 March 2009








  • WowWee Robopanda
    Conscious Robots - Monday, 30 March 2009











  • AMOUSE The Robotic Mouse
    Conscious Robots - Monday, 30 March 2009







  • Robotic Carp
    Conscious Robots - Monday, 30 March 2009






  • Huggable


    The Huggable Robot
    Conscious Robots - Monday, 30 March 2009





Wednesday, March 25, 2009

Finally my robotics studio works

i downloaded microsoft robotics studio 1.5 since last year, and suprisingly i couldn't even run a simple Hello project with it, it was given me a xml schema validation error, and i called on the help of every body i knew to help solve it, we were not able to fix it.

when the new version was released,i downloaded the express edition with the hope that it will be better this time, "na lie", it didn't work.

But thanks to God,without doing anything i finally got it to work yesterday after 3 installations and uninstallations. i don't know if it was a bug or not, but i'm sure glad it's working.

Now i can do something..

Wednesday, March 4, 2009

You know you are addicted to coffee when...

You are employee of the month at the local coffee house and you don't even work there. Your eyes stay open when you sneeze, you cherw on other people's finger nails,You can type sixty words per minute with your feet, you can jump start your car without cables. You don't sweat, you percolate.You've worn out the handle of your favorite coffee mug.

You walk twenty miles on your treadmill, before you realize it's not hooked up. you're so wired you pick up radio signals. your birthday is a ntaional holiday in brazi. you go to sleep just so you can wake up and smell the coffee. you namme your rats, "cream" and 'sugar'. your lips are permanently stuck in the sipping position, you have a picture of your coffee mug on your coffe mug.

you don't tan,you roast.you don't get mad, you get steamed .your cofee mug is insured by IGI insurance, you introduce your spouse as your coffee mate, you think CPR stands for coffee provides resusciation, you ski uphill,you get a speeding ticket even when you r parked. you haven't blinked since your last lunar eclipse, you just completed another sweater and you don't even know how to knit.

The Bible says "taste and see that the Lord is good".Here's an idea why not turn your coffee break into a time with God. carry a scripture with you. meditate while you sip, talk to God while you savor. doing this would transform your life.

Culled from a box of delights(J. John and Mark Stibble) and a word for today

Thursday, February 26, 2009

Ideas for cards

in case u need "lyrics" for some cards you need to give to some friends,here are some i saw somewhere, i am sure you will find one to use.

Cover: I must admit u brought religion into my life
Inside: I never believed in hell till i met you

COver:As d days go by,i think how lucky i am
Inside: That you are not heren to ruin it

Cover:We've been friends for a long time
Inside: when do you say we stop

Cover:I always wanted to have someone to hold,to cherish and to luv,now that you have come into my life
Inside: I have changed my mind

Cheers.

Wednesday, February 25, 2009

How to make your first million naira…fast

Stop…
So you still think there’s a thing like fast money. I thought by now you will have been staying clear of any get rich scheme.They don’t ever seem to work,anyway i am about to introduce you to a very sure way of making quick money fast.

SING NONSENSE.Yes, you heard right, Sing, especially nonsense. Take a look around you.People are making a lot of money from singing, and guess what you don’t have to have anything to say. it’s amazing, you can sing gibberish,(e.g Konga) or you can just take a word and repeat it all over again(e.g Alhaji(who in d world sang that song) or you can abuse people(e.g Ori e foka si be(Your head scatter) by DJ Zeez), the list is endless, if they can do it, then you can too. of course ,make sure you have a catchy phrase,that they will use to identify you,(e.g Koko), and use nice beats preferably stolen from a mix of American music and indian music(nobody will know its stolen and you are sure it will sell,it already sold in the US).
If you succed in doing all this,i can assure you the only person who can stop you from making that million is K**** and D-*.
So don’t let me catch you complaining that you don’t have money, you are your own future.