I was developing a project with a WCF REST and TCP(inter-role) endpoint on Windows 7. I just upgraded to Windows 8 and now I have serious problems with it.
First of all, when I deploy my project to azure I get these warnings:
Windows Azure Tools: Warning: Remapping private port 80 to 81 in role 'OfisimCRM.WebClient' to avoid conflict during emulation.
Windows Azure Tools: Warning: Remapping private port 443 to 446 in role 'OfisimCRM.WebClient' to avoid conflict during emulation.
Skype is disabled and it is not the issue.
this is not so important but the important thing is I'm getting more serious errors from my interrole communication requests although I disabled firewall completely. Here it is:
Could not connect to net.tcp://127.255.0.0:22000/NotifyService. The connection attempt lasted for a time span of 00:00:01.1820716. TCP error code 10061: No connection could be made because the target machine actively refused it 127.255.0.0:22000. -
Server stack trace:
at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
TCP client code:
public static LicenseItem CheckLicense(int userID)
{
// This instance does not exist in memory cache. Check if other servers in the same web role know anything about this instance.
var webRoles = RoleEnvironment.Roles["OfisimCRM.WebClient"];
var myID = RoleEnvironment.CurrentRoleInstance.Id;
LicenseItem remoteValue = null;
foreach (var targetInstance in webRoles.Instances)
{
// I am currently going through a loop of instances. Check if the current enumaration shows my address.
if (targetInstance.Id == myID)
{
// Skip.
}
else
{
// This is a neighbour instance. Check to see if it knows about the instance I'm looking for.
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
EndpointAddress targetAddress = new EndpointAddress(
String.Format("net.tcp://{0}/NotifyService", targetInstance.InstanceEndpoints["NotificationServiceEndPoint"].IPEndpoint)
);
ChannelFactory<INotifyService> channelFactory = new ChannelFactory<INotifyService>(binding, targetAddress);
INotifyService targetClient = channelFactory.CreateChannel();
try
{
remoteValue = targetClient.CheckLicense(userID);
if (channelFactory.State != System.ServiceModel.CommunicationState.Faulted)
{
channelFactory.Close();
}
}
catch (TimeoutException timeoutException)
{
Trace.TraceError("Unable to check license on web role instance '{0}'. The service operation timed out. {1}", myID, timeoutException.Message);
((ICommunicationObject)targetClient).Abort();
}
catch (CommunicationException communicationException)
{
Trace.TraceError("Unable to check instance on web role instance '{0}'. There was a communication problem. {1} - {2}", myID, communicationException.Message, communicationException.StackTrace);
((ICommunicationObject)targetClient).Abort();
}
}
}
return remoteValue;
}
Edit 1: Important Update:
I think the problem is about the second instance. I did a debug and I saw the connection refused only by this stopped instance. I think this explains everything but I don't know why it is happening.
Edit 2: Temprorary Solution:
I noticed that is not an issue about Windows 8 because I was upgraded Azure SDK June 2012 SP1 to Fall 2012. I downloaded the not upgraded version of my project from TFS than I saw it's working. In conclusion, its the Azure SDK but I don't know why.