.NET serializer and WCF bindings for AMF with full Flex compatibility. Just add AMF endpoints to your existing WCF services and you are ready to go.
Latest commit 3b5f199 Nov 29, 2015 @artema Added NuGet packages.


NuGet packages: DotAmf (serializer) and DotAmf.Wcf (service layer).


.NET serializer and WCF bindings for AMF with full Flex remoting support.

Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. The Actionscript 3 language provides classes for encoding and decoding from the AMF format.


AMF has several advantages over existing serialization formats, including the ability to maintain objects graph, a small footprint when storing a set of identical objects (including strings) or references to the same object, and a wide range of natively supported types (such as XmlDocument, DateTime and Dictionary).

WCF Configuration

Consider the following service contracts:

    using System;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.Xml;

    namespace ExampleService
        public interface IMyService
            ProductVo[] GetAllProducts();

            [OperationContract(Name = "GetUser")] //Custom procedure name
            User GetUserDataContract(int id);

            int AddUser(User user);

            Content SendContent(Content content);

            User[] SendGraph(User[] users);

            void DoStuff();

            void DoFault();

        [DataContract] //Will have the "ExampleService.User" alias
        public class User
            [DataMember(Name = "id")] //Custom field name
            public int Id { get; set; }

            [DataMember(Name = "is_active")]
            public bool IsActive { get; set; }

            [DataMember] //Use explicit name
            public string name { get; set; }

            [DataMember(Name = "products")]
            public ProductVo[] Products { get; set; }

        [DataContract(Name = "Product")] //Custom alias
        public class ProductVo
            [DataMember(Name = "id")]
            public int Id { get; set; }

        public class CustomFault
            [DataMember(Name = "date")]
            public DateTime Date { get; set; }

            [DataMember(Name = "message")]
            public string Message { get; set; }

        public class Content
            [DataMember(Name = "data")]
            public byte[] Data { get; set; }

            [DataMember(Name = "xml")]
            public XmlDocument Xml { get; set; }

To add an AMF support to a service, you only need to update your configuration:

<?xml version="1.0"?>
    <compilation debug="true" targetFramework="4.0" />
        <add name="amfBehaviorExtension" type="DotAmf.ServiceModel.Configuration.AmfBehaviorExtensionElement, DotAmf.Wcf"/>
        <add name="amfBindingExtension" type="DotAmf.ServiceModel.Configuration.AmfBindingExtensionElement, DotAmf.Wcf"/>
        <behavior name="amfEndpoint">
        <behavior name="amfServiceBehavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="false"/>
        <binding name="amfBinding">
      <service name="ExampleService.MyService" behaviorConfiguration="amfServiceBehavior">
        <endpoint address="" contract="ExampleService.IMyService" binding="customBinding" bindingConfiguration="amfBinding" behaviorConfiguration="amfEndpoint"/>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="false"/>

See the Examples folder for a complete service and client implementations.


You can use DataContractAmfSerializer to serialize and deserialize from binary AMF data outside of the WCF.

CustomType objectToWrite;

var knownTypes = new[] {
var serializer = new DataContractAmfSerializer(typeof(CustomType), knownTypes);

using (var stream = new MemoryStream())
    serializer.WriteObject(stream, objectToWrite);