Windows Azure inner-role communication on internal endpoint with a WCF service hosted outside of RoleEntrypoint

At some point, you might experience some issues if you try to consume a service that is hosted on another role instance that is not being hosted in the default workerrole process.

Scenario:
We host a WCF Service in a windows service that is being installed on the azure role instance by a startup Task. This means the WCF service is not being hosted inside of the workerrole, which derives from the RoleEntryPoint.
We want to consume this service from another role instance.

Setup:
For the first role instance where we host the WCF service in a windows service, we need to define an internal endpoint, which we will use for the WCF service to listen on.

This endpoint is only used for communication between both the role instances, thus making it an internal endpoint.

InternalEndpoint

The required binaries of the windows service get copied to the windows azure instance by

Windows Azure Contents copy

We also have a startup task defined, which triggers the install of the windows service on the azure instance.  This startup task startup.cmd has been copied to the azure instance at the approot/definedfolder/ by the contents copy, together with the necessary windows service binaries.

Windows Azure startup task

Continue reading