AvinashK
AvinashK

Reputation: 3423

Invalid xpath expression being shown in csdef of Azure cloud service project

In the csdef file of Azure Cloud Service Project, I have the following environmental variable defined:

      <Variable name="MONITORING_DATA_DIRECTORY">
        <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='MonitoringDataDirectory']/@path" />
      </Variable>

The project builds successfully. However, when I try to run the project, it throws an error saying '/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='MonitoringDataDirectory']/@path' is an invalid xpath expression.

Here is a similar question on stackoverflow, but I don't know how to apply the solution to my case. Can anyone help me here?

Upvotes: 2

Views: 476

Answers (1)

supwar
supwar

Reputation: 222

I just ran into this exact same problem, with the exact same variable, "MONITORING_DATA_DIRECTORY". It turns out that the error message is a bit misleading. The XPath is perfectly valid. The problem was that my .csdef file didn't have a LocalResource named "MonitoringDataStore" declared. Adding this code to the .csdef solved the problem:

<LocalResources>
  <LocalStorage name="MonitoringDataStore" cleanOnRoleRecycle="false" sizeInMB="200000" />
</LocalResources>

Upvotes: 4

Related Questions