Problem with Silverlight Integration Pack

Topics: Silverlight Integration Pack
Sep 21, 2011 at 10:18 AM

Hi.

I was trying entlib silverlight's logging block, and it was  working well both on Server and Client.

But I found that silverlight's endpoint's address was configured in the ServiceReferences.ClientConfig

like this

ServiceReferences.ClientConfig

 

<client>
      <endpoint address="/LoggingService.svc"
          binding="customBinding" bindingConfiguration="CustomBinding_ILoggingService"
          contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" name="CustomBinding_ILoggingService" />
 </client>

 

Can I set the address in the code?

Thanks.

 

ServiceReferences.ClientConfig Copy Code
<configuration>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="CustomBinding_ILoggingService">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="/LoggingService.svc"
          binding="customBinding" bindingConfiguration="CustomBinding_ILoggingService"
          contract="Microsoft.Practices.EnterpriseLibrary.Logging.Service.ILoggingService" name="CustomBinding_ILoggingService" />
    </client>
  </system.serviceModel>
</configuration>
Sep 21, 2011 at 11:00 AM

I believe there is no specific way on doing this in silverlight integration. Modifying the servicereference.clientconfig might do the trick. Another similar question has been asked on this thread.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 22, 2011 at 1:27 AM
Edited Sep 22, 2011 at 2:05 AM

Thank you for the reply,

but How to modify the ServiceReferences.ClientConfig "dynamically" when it has already been placed in a xap file??

Sep 22, 2011 at 2:37 AM

Hi,

It seems this is possible as according to this link:

"Hi. Yes, this is possible for example by doing this:

Uri endpointUri = new Uri("http://www.example.com/service.svc", UriKind.Absolute); 
EndpointAddress serviceAddress = new EndpointAddress(endpointUri); 
MyServiceClient client = new MyServiceClient("MyServiceCustom", serviceAddress);

The first argument of the client constructor is the name of the endpoint in the configuration file. This overrides the endpoint to use on the client.

Edit: This post from Tony describes everything in detail."

Hope this helps.

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us