3

I have an issue with obtaining data from Windows Azure's runtime using the newest (at the time of writing) PHP SDK from Github. Here is a test I am running on one of our hosted services:

<?php

include 'WindowsAzure/WindowsAzure.php';
use \WindowsAzure\ServiceRuntime\RoleEnvironment;
use \WindowsAzure\ServiceRuntime\Internal\RoleEnvironmentNotAvailableException;

try {
    echo RoleEnvironment::getDeploymentId();
}
catch (RoleEnvironmentNotAvailableException $Exception) {
    die('Failed to find deployment id');
}

RoleEnvironmentNotAvailableException is always thrown. Looking at the source, it seems to try sending commands through a named pipe (\.\pipe\WindowsAzureRuntime). Do I need to specify something within my ServiceConfiguration.csdef/cscfg in order to have access to this named pipe?

Any advice would be most welcome!

jonnu
  • 728
  • 4
  • 12
  • Incidentally, if I use the **RoleEnvironmentProxy.exe** binary that was packaged with the _old_ SDK (the one developed by RealDolmen), it seems to work just fine: **RoleEnvironmentProxy.exe IsAvailable** returns **True** – jonnu Sep 11 '12 at 07:48

2 Answers2

3

Got confirmation from MS EMEA Developer Support that current SDK does not support this function. They suggested similar workaround to jonnu above - use the previous SDK's functionality for role environment / configuration settings.

R Cohen
  • 66
  • 5
-1

The ServiceRuntime APIs run only on Cloud so if this code snippet runs on local machine it'll throw an exception as you've pointed out. Further, if you want to debug your ServiceRuntime code you've to deploy your service to WA then use remote desktop connection to access the cloud machine and debug your code.

Ogail
  • 177
  • 6
  • Thanks for the answer. The exception is being thrown on a staging hosted instance in the Azure cloud, however. – jonnu Sep 13 '12 at 08:09
  • Yeah, sorry but this answer is not correct for this specific problem. – Lukos Apr 11 '13 at 13:53