【问题标题】:Windows 8 Azure Emulator is Remapping Port 80 to 81Windows 8 Azure 模拟器将端口 80 重新映射到 81
【发布时间】:2012-11-07 14:44:25
【问题描述】:

我在 Windows 7 上开发了一个带有 WCF REST 和 TCP(角色间)端点的项目。我刚刚升级到 Windows 8,现在我遇到了严重的问题。

首先,当我将项目部署到 azure 时,我收到以下警告:

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 已禁用,这不是问题。

这不是那么重要,但重要的是我从我的交互通信请求中得到了更严重的错误,尽管我完全禁用了防火墙。这里是:

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 客户端代码:

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;
}

编辑 1:重要更新:

我认为问题出在第二个实例上。我做了一个调试,我看到连接只被这个停止的实例拒绝。我认为这可以解释一切,但我不知道为什么会这样。

编辑 2:临时解决方案:

我注意到这不是 Windows 8 的问题,因为我已将 Azure SDK 2012 年 6 月 SP1 升级到 2012 年秋季。我从 TFS 下载了我的项目的未升级版本,但我看到它正在工作。总之,它是 Azure SDK,但我不知道为什么。

【问题讨论】:

  • 你是如何发现你的角色端点的——你能发布导致连接错误的代码吗?
  • 它在 Windows 7 开发中工作。环境也在 Azure 生产中,但不在 Windows 8 开发中。环境。
  • 嗯。我看不出有什么问题。模拟器会定期在我的 Win7 机器上从 80 重新映射到 81,所以我不认为这是任何错误的征兆。
  • 这与 Windows 8 有关。降级似乎是目前唯一的解决方案。 ://
  • 我会在这样做之前给它一点时间。一位真正的 Azure 负责人可能会有答案。

标签: wcf azure tcp windows-8 port


【解决方案1】:

重新映射端口号根本不是问题的症状。这是正常行为,而且一直如此。 在执行/配置您的 Windows 8 Dev Box 时,您是否安装了“Windows 功能”WCF 激活:

另一种测试您的服务是否真正启动并运行的方法是:

  • 通过启动 Compute Emulator 并期待本地部署来确保您拥有端点
  • 在提供的 IP 和端口号上 telnet 以查看是否可以实际建立连接

验证端点 UI:

好吧,这将显示输入端点。从我看到的情况来看,您正在使用内部端点。只是为了试用,尝试将它们更改为 Input,看看是否会有一些行为变化。

但首先要检查您是否安装了 WCF 激活。

【讨论】:

  • 是的,你是对的。 WCF 下的所有内容都已安装。我注意到第二个实例没有在 IIS 上运行。当我尝试启动它时,它给了我正在使用的端口错误。我用一张图片更新了我的答案。你知道是什么原因造成的吗?
【解决方案2】:

当我忘记在我的开发盒上取消绑定 IIS(完整 IIS)中的默认网站时,我总是会遇到这个问题。你记得这样做吗?默认情况下,您的本地 IIS 会将 http 绑定到“默认网站”上的端口 80。如果您将该绑定(使用 inetmgr)编辑到另一个端口,则模拟器可以抓取 80。

【讨论】:

  • 是的,我删除了默认网站。我更新了我的问题,你可以看看吗?
猜你喜欢
  • 2019-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多