Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Endpoint.Behaviors collection not available in WCF (in Silverlight proxy class)RSS Feed

27 views
Skip to first unread message

Murtaza

unread,
Dec 17, 2009, 8:02:45 AM12/17/09
to
Hi friends,

Well this might not be a best place to raise this query but since I
am accessing a WCF service from Silverlight, I am posting it here.

I am creating binding and endpoints programmtically in Silverlight
client which accesses locally hosted WCF services.

I want to add endpoint behaviors in my proxy as suggested in the
following article.

http://www.aspfree.com/c/a/BrainDump/Building-Blocks-for-a-WCF-Service-Web-Site/1/

To programmatically configure endpoint behaviors, you can use the
object model of the client proxy. TheEndpointproperty of the client
proxy has aBehaviorscollection through which you can search for
existing behaviors and add behaviors--similar to the way you would for
theServiceHost. Example 1-11 shows an example that looks to see if
theServiceDebugBehaviorexists, and if not adds it to the collection.

Example 1-11. Adding the debug service behavior programmatically

HelloIndigoServiceClient proxy = new HelloIndigoServiceClient();

ServiceDebugBehavior debugBehavior =
proxy.Endpoint.Behaviors.Find<ServiceDebugBehavior>();

if (debugBehavior == null)
{
debugBehavior = new ServiceDebugBehavior();

debugBehavior.IncludeExceptionDetailInFaults = true;
proxy.Endpoint.Behaviors.Add(debugBehavior);
}
Surprisingly, I am not getting the "Behaviors" collection property on
my proxy (service client) class which has been auto generated when I
added the service reference. I am using .Net 3.5. What could be the
problem? I also checked MSDN documentation which says this property
is still available.

Please help me on this if you have some ideas. Thanks.

Murtaza

0 new messages