Slow and steady Silverlight (39)

Source: Internet
Author: User
Tags new features silverlight

Back to the "Steady Silverlight 3.0 series Article index"

Introduced

New features of Silverlight 3.0 communication

Binary XML communication-communicating with WCF services, using binary XML to pass data (improve transport performance)

Local Area Connection-allows direct communication between two Silverlight programs on the client (not through the server)

Online Demo

Http://www.cnblogs.com/webabcd/archive/2009/08/04/1538238.html

Example

1. Demo of data passing in binary XML

Service side (WCF)

Binaryxmlservice.svc

using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Text;

namespace Silverlight30.Service
{
/**//// <summary>
/// 一个简单的 WCF 服务
/// </summary>
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class BinaryXmlService
{
[OperationContract]
public string Hello(string name)
{
return "Hello: " + name;
}
}
}

Web.config

<system.serviceModel>
<bindings>
<customBinding>
<binding name= "CUSTOMBINDING0" >
<binarymessageencoding/>
</binding>
</customBinding>
</bindings>
<servicehostingenvironment aspnetcompatibilityenabled= "true"/>
<behaviors>
<serviceBehaviors>
<behavior name= "Silverlight30.Service.BinaryXmlServiceBehavior" >
<servicemetadata httpgetenabled= "true"/>
<servicedebug includeexceptiondetailinfaults= "false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorconfiguration= "Silverlight30.Service.BinaryXmlServiceBehavior"
Name= "Silverlight30.Service.BinaryXmlService" >
<endpoint address= "" binding= "CustomBinding" bindingconfiguration= "CUSTOMBINDING0"
contract= "Silverlight30.Service.BinaryXmlService"/>
<endpoint address= "Mex" binding= "mexHttpBinding" contract= "IMetadataExchange"/>
</service>
</services>
</system.serviceModel>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.