ServerManager class, my site is not in the Site Collection on Azure Compute Emulator

344 Views Asked by At

I have a WebRole named Web, and I am running this code in the Azure Compute Emulator:

    public override bool OnStart()
    {
        using (var serverManager = new ServerManager())
        {
            string strSiteName = RoleEnvironment.CurrentRoleInstance.Id + "_" + "Web";
            Site theSite = serverManager.Sites[strSiteName];

        }
        return base.OnStart();
    }

but serverManager.Sites only returns sites located in my local IIS, but I need the site hosted in Windows Azure Emulator.

Any suggestions?

1

There are 1 best solutions below

0
On

I think the emulator uses IIS Express by default these days. I bet that if you switch it to use full IIS (somewhere in the cloud project's properties, IIRC), things will work as expected.