If you would like to connect to an Azure Silo from an Azure Web App rather than a Web Role hosted within the same cloud service you can.
For this to work securely you will need to assign both the Azure Web App and the Worker Role hosting the Silo to an Azure Virtual Network.
First we’ll setup the Azure Web App, you can follow this guide which will create the virtual network and assign it to the Azure Web App.
Now we can assign the cloud service to the virtual network by modifying the ServiceConfiguration file.
<NetworkConfiguration>
<VirtualNetworkSite name="virtual-network-name" />
<AddressAssignments>
<InstanceAddress roleName="role-name">
<Subnets>
<Subnet name="subnet-name" />
</Subnets>
</InstanceAddress>
</AddressAssignments>
</NetworkConfiguration>
Also make sure the Silo endpoints are configured.
<Endpoints>
<InternalEndpoint name="OrleansSiloEndpoint" protocol="tcp" port="11111" />
<InternalEndpoint name="OrleansProxyEndpoint" protocol="tcp" port="30000" />
</Endpoints>
Finally, you need to specify the same deployment id for Silos and the Wen App Client.
You can now use the GrainClient to make a connection from the Web App to the Silo.
If the Web App is having difficulty connecting to the Silo:
DeploymentId.PowerShell:New-AzureNetworkSecurityGroup -Name "Default" -Location "North Europe"
Get-AzureNetworkSecurityGroup -Name "Default" | Set-AzureNetworkSecurityGroupToSubnet -VirtualNetworkName "virtual-network-name" -SubnetName "subnet-name"