Worker role in Azure with HttpListener, deployment failed

I created a new worker role for a websocket server. But when I would deployed to Azure an error accoured, I did not get any message in Visual Studio but when I opend the Azure portal I found an message that told me that a HttpListenerException occoured. My first thought was that it was a conflict with the port that the worker listened at. But I tried other ports and same result. After som researched I found that the worker was not allowed to register HttpListener.

The solution was to add <Runtime executionContext=”elevated” /> to the ServiceDefinition. When I deployed the worker after adding it the deploy was successful.

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="DefinitionName" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
  <WorkerRole name="MyWorker" vmsize="ExtraSmall">
    <Runtime executionContext="elevated" />
    <Imports>
      <Import moduleName="Diagnostics" />
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
    <Endpoints>
      <InputEndpoint name="endpoint" protocol="http" port="80" localPort="80" />
    </Endpoints>
  </WorkerRole>
</ServiceDefinition>