This project has moved and is read-only. For the latest updates, please go here.

[en] Hosting Zyan in Azure

Topics: Announcements
May 29, 2011 at 12:05 AM
Edited May 31, 2011 at 6:01 PM

Hi all,

I´ve found a way to host Zyan applications on Microsoft´s Cloud Platform Azure. It´s quite easy. An Azure Worker Role can be used as cloud host. This Worker Role can have it´s own IP endpoints, which can be used as Ports for Zyan. A TCP endpoint from type "input" must be defined inside the Azure Worker Role. Then we can add the a reference to Zyan.Communication.dll (need to be compiled for .NET 4.0 Client Profile as target framework first!). The assemblys of the server application, we want to bring into the cloud, must also be added. 

As usual we need a ZyanComponentHost on server side. The integration in the Azure Worker Role is as easy as writing a console application. Have a look:

// Hosting the MiniChat example in the Azure cloud.
public class WorkerRole : RoleEntryPoint
    public override void Run()
        // This is a sample worker implementation. Replace with your logic.
        Trace.WriteLine("ZyanWorkerRole entry point called", "Information");

        // Get the configured IP endpoint of the Azure worker role
        IPEndPoint endPoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["ZyanEndPoint"].IPEndpoint;

       // Setup the ZyanComponentHost,
       TcpDuplexServerProtocolSetup protocol = new TcpDuplexServerProtocolSetup(endPoint.Port, new NullAuthenticationProvider());
        ZyanComponentHost host = new ZyanComponentHost("MiniChat", protocol);

        // Register the MiniChat server component
        host.RegisterComponent<IMiniChat, MiniChat>(ActivationType.Singleton);

        while (true)
            Trace.WriteLine("Working", "Information");



It works fine in the local simulation. As soon as I have a valid test Azure test account, I try it for real.
When that tests are successful, then I can say, Zyan is ready for the current buzz word #1 (Cloud Computing).



May 31, 2011 at 9:07 PM

Hi, Rainbird!

Thanks for sharing this!
It's worth a dedicated wiki page.

I think, Windows Azure is not the only option for Zyan-powered cloud application.
Since Zyan supports Mono, it may be used on Linux-based services such as Linode or Amazon EC2.

Jun 1, 2011 at 12:12 PM
yallie wrote:

Since Zyan supports Mono, it may be used on Linux-based services such as Linode or Amazon EC2.

Yes, of course. But we have to test version 2.0 with mono first.

Jun 6, 2011 at 9:25 PM

Its working! I´ve created a Azure hosted version of the MiniChat example.
It works with the default MiniChat client. Just set the server URL to 'tcpex://' (Server-URL ComboBox on the login window).

Please feel free to test.

The azure account is a 30 day test account only.

Jun 7, 2011 at 2:37 AM

Cool :)

It works indeed.

By the way, isn't Zyan a German word for Azure? :)

Jun 7, 2011 at 5:57 AM
yallie wrote:

By the way, isn't Zyan a German word for Azure? :)

Zyan is the German word for cyan. Azure (German: Azur) is different color. Have a look at the following color table:

Jun 7, 2011 at 11:07 AM
Edited Jun 7, 2011 at 11:08 AM

Oh, I see. Zyan is richer than Azure :)

bgcolor="azure" bgcolor="cyan"
Jun 7, 2011 at 11:53 PM


Aug 10, 2011 at 10:42 PM

I'm new to zyan and would like to post a (maybe silly) question: is it possible to host a zyan server module in IIS(6/7) and use tcpex protocol?


Aug 11, 2011 at 1:03 AM

Hello Fonzi,

I´ve not tested IIS hosting yet.
You can try to host your Zyan server inside a ASP.NET web application. Put your server code to global.asax.

Example (MiniChat IIS hosted) *** NOT TESTED ***

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
using Zyan.Examples.MiniChat.Shared;

namespace Zyan.Examples.MiniChat.AspNetHostedServer
    public class Global : System.Web.HttpApplication
        private ZyanComponentHost _host=null;

        protected void Application_Start(object sender, EventArgs e)
            Program.ActiveNicknames = new List<string>();

            TcpDuplexServerProtocolSetup protocol = new TcpDuplexServerProtocolSetup(Properties.Settings.Default.TcpPort, new NicknameAuthProvider(), true);
            _host = new ZyanComponentHost("MiniChat",protocol);
            _host.RegisterComponent<IMiniChat, MiniChat>(ActivationType.Singleton);          

        protected void Session_Start(object sender, EventArgs e)


        protected void Application_BeginRequest(object sender, EventArgs e)


        protected void Application_AuthenticateRequest(object sender, EventArgs e)


        protected void Application_Error(object sender, EventArgs e)


        protected void Session_End(object sender, EventArgs e)


        protected void Application_End(object sender, EventArgs e)
            if (_host != null)

    public class Program
        public static List<string> ActiveNicknames

Please give me feedback about success or any problems with that approach.