Monday, 15 July 2013

.net - What does "www" do to my endpoint bindings? -



.net - What does "www" do to my endpoint bindings? -

so have been deploying silverlight website lately, , noticed pretty horrific bug already.

my silverlight app has 5 bindings wcf services hosted on web app on same website, 1 folder ahead. let's website www.test.com. here bindings silverlight app's servicereferences.clientconfig:

<client> <endpoint address="http://www.test.com/mywebservice/service1.svc" binding="custombinding" bindingconfiguration="custombinding_iservice1" contract="service1.iservice1" name="custombinding_iservice1" /> <endpoint address="http://www.test.com/mywebservice/service2.svc" binding="custombinding" bindingconfiguration="custombinding_iservice2" contract="service2.iservice2" name="custombinding_iservice2" /> <endpoint address="http://www.test.com/mywebservice/service3.svc" binding="custombinding" bindingconfiguration="custombinding_iservice3" contract="service3.iservice3" name="custombinding_iservice3" /> <endpoint address="http://www.test.com/mywebservice/service4.svc" binding="custombinding" bindingconfiguration="custombinding_iservice4" contract="service4.iservice4" name="custombinding_iservice4" /> <endpoint address="http://www.test.com/mywebservice/service5.svc" binding="custombinding" bindingconfiguration="custombinding_iservice5" contract="service5.iservice5" name="custombinding_iservice5" /> </client>

so problem when load silverlight app, on default aspx page hosted @ root directory of iis website, connexions work when type test.com in url address, , not when type www.test.com. doesn't fail, info should extracted through services doesn't show, , cannot connect credentials. (since 1 of services used authentication)

i tried changing values app's servicereferences.clientconfig removing www, situation not alter 1 bit. still connects without www in url, , not when www on.

well, this lovely post, got surpass problem. explain had in here, in case link goes dead.

all had alter each instantiation of each service client in silverlight code :

service.iservice proxy = new service.serviceclient();

to :

uri servuri = new uri("../mywebservice/service.svc", urikind.relative); endpointaddress servaddr = new endpointaddress(servuri); service.iservice proxy = new service.serviceclient("custombinding_iservice", servaddr);

as explained in blog post, ".." necessary since silverlight app (usually) located in clientbin folder.

and did trick me!

.net wcf web-services silverlight silverlight-4.0

No comments:

Post a Comment