开发者

"role discovery data is unavailable" in Compute Emulator with > 1 instance (in Web Role)

On VS2010 SP1 with Azure 1.4 SDK

Create a new Azure Project and a single Web Role, in Page_Load of default.aspx.cs add开发者_开发知识库:

string id = RoleEnvironment.CurrentRoleInstance.Id;
Response.Write("CurrentRoleInstance.Id: " + id);

This works, now change Instance count to 2 or more.

role discovery data is unavailable "InvalidOperationException"

Why is this?

This works fine on deployment to Azure.


Do ran your application on Azure compute emulator? This error occurred when not ran on Azure instance or compute emulator.

If possible, Could you change page_load method follows:

        protected void Page_Load(object sender, EventArgs e)
    {
        if (RoleEnvironment.IsAvailable)
        {
            string id = RoleEnvironment.CurrentRoleInstance.Id;
            if (RoleEnvironment.IsEmulated)
            {
                Response.Write("(Emulator) CurrentRoleInstance.Id: " + id);
            }
            else
            {
                Response.Write("(Azure Platform) CurrentRoleInstance.Id: " + id);
            }
        }
        else
        {
            Response.Write("Not run on azure environment");
        }

    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜