I have an Azure project that contains a WCF Services Web Role and an ASP.NET Forms web role, I use 2 instances of each. The ASP.NET Forms web role will regularly call the WCF Services Web Role through standard service references through tcp binding configured in the Web.config like this.
<endpoint address="net.tcp://localhost:666/EventService.svc"
behaviorConfiguration="DefaultBehaviour" binding="netTcpBinding"
bindingConfiguration="TCPBinding" contract="EventService.IEventService"
name="EventService" />
The problem I am having is that currently I have no way to deploy these roles without manually editing the web.config files after each deployment (because the IP endpoint addresses which these roles deploy on may change).
The way I have considered resolving this issue is by intercepting the WebRole.OnStart()
event and using RoleEnvironment.Roles["MyWCFServices"].Instances
, then modifying the Web.config file directly through Microsoft.Web.Administration.ServerManager
to reference the correct WCF Service IP.
However before I go this route could someone please confirm there isn't an easier way to accomplish IP referencing between web roles in the Azure platform?