草庐IT

wcf - Windows 8 Azure 模拟器正在将端口 80 重新映射到 81

coder 2023-09-18 原文

我在 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 8 Dev Box 时,您是否安装了“Windows 功能”WCF 激活:

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

  • 通过启动计算模拟器并期待本地部署来确保您拥有端点
  • 在提供的 IP 和端口号上 telnet 以查看是否可以真正建立连接

验证端点 UI:

好吧,这将向您显示输入端点。据我所知,您正在使用内部端点。只是为了试用,尝试将它们更改为 Input 以查看行为是否会发生一些变化。

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

关于wcf - Windows 8 Azure 模拟器正在将端口 80 重新映射到 81,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13272013/

有关wcf - Windows 8 Azure 模拟器正在将端口 80 重新映射到 81的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby - 在 Windows 机器上使用 Ruby 进行开发是否会适得其反? - 2

    这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby​​-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub

  3. ruby-on-rails - Ruby on Rails 可以部署在 Azure 网站上吗? - 2

    我可以在Azure网站上部署RubyonRails吗? 最佳答案 还没有。目前仅支持.NET和PHP。 关于ruby-on-rails-RubyonRails可以部署在Azure网站上吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/12964010/

  4. Vscode+Cmake配置并运行opencv环境(Windows和Ubuntu大同小异) - 2

    之前在培训新生的时候,windows环境下配置opencv环境一直教的都是网上主流的vsstudio配置属性表,但是这个似乎对新生来说难度略高(虽然个人觉得完全是他们自己的问题),加之暑假之后对cmake实在是爱不释手,且这样配置确实十分简单(其实都不需要配置),故斗胆妄言vscode下配置CV之法。其实极为简单,图比较多所以很长。如果你看此文还配不好,你应该思考一下是不是自己的问题。闲话少说,直接开始。0.CMkae简介有的人到大二了都不知道cmake是什么,我不说是谁。CMake是一个开源免费并且跨平台的构建工具,可以用简单的语句来描述所有平台的编译过程。它能够根据当前所在平台输出对应的m

  5. 深度学习部署:Windows安装pycocotools报错解决方法 - 2

    深度学习部署:Windows安装pycocotools报错解决方法1.pycocotools库的简介2.pycocotools安装的坑3.解决办法更多Ai资讯:公主号AiCharm本系列是作者在跑一些深度学习实例时,遇到的各种各样的问题及解决办法,希望能够帮助到大家。ERROR:Commanderroredoutwithexitstatus1:'D:\Anaconda3\python.exe'-u-c'importsys,setuptools,tokenize;sys.argv[0]='"'"'C:\\Users\\46653\\AppData\\Local\\Temp\\pip-instal

  6. ruby - 如何在 Ruby 中执行 Windows CLI 命令? - 2

    我在目录“C:\DocumentsandSettings\test.exe”中有一个文件,但是当我用单引号编写命令时`C:\DocumentsandSettings\test.exe(我无法在此框中显示),用于在Ruby中执行命令,我无法这样做,我收到的错误是找不到文件或目录。我尝试用“//”和“\”替换“\”,但似乎没有任何效果。我也使用过系统、IO.popen和exec命令,但所有的努力都是徒劳的。exec命令还使程序退出,这是我不想发生的。提前致谢。 最佳答案 反引号环境就像双引号,所以反斜杠用于转义。此外,Ruby会将空格解

  7. ruby - 错误 : Failed to build gem native extension on Windows - 2

    我在安装“redcarpet”gem时遇到以下错误。它在我friend的机器上安装没有问题。(我想安装它来运行yard)ruby版本:1.9.3命令输出:D:\Learning\Common_POM_FW\SampleProjects>yard[error]:Missing'redcarpet'gemforMarkdownformatting.Installitwith`geminstallredcarpet`D:\Learning\Common_POM_FW\SampleProjects>geminstallredcarpetTemporarilyenhancingPATHtoinc

  8. ruby - 从 Ruby 连接到适用于 Windows Phone 8 的 Microsoft 推送通知服务 - 2

    我们正在开发一个需要推送通知的WP8应用程序。为了测试它,我们使用CURL命令行运行推送通知POST请求,确保它实际连接,使用客户端SSL证书进行身份验证并发送正确的数据。我们确实知道,当我们收到对设备的推送时,这项工作是有效的。这是我们一直用于测试目的的CURL命令:curl--certclient_cert.pem-v-H"Content-Type:text/xml"-H"X-WindowsPhone-Target:Toast"-H"X-NotificationClass:2"-XPOST-d"MytitleMysubtitle"https://db3.notify.live.ne

  9. ruby - 在 Windows 7 上运行 Jekyll - 2

    我在Windows7上运行Jekyll时遇到问题。当我运行时jekyll出现以下错误C:\temp\jekyll\kouphax.github.com>jekyllConfigurationfromC:/temp/jekyll/kouphax.github.com/_config.ymlBuildingsite:C:/temp/jekyll/kouphax.github.com->C:/temp/jekyll/kouphax.github.com/_siteunit-testingYouaremissingalibraryrequiredforTextile.Pleaserun:$[s

  10. ruby - 尝试在 Windows 8 (x64) : Error installing fast-stemmer-1. 0.2.gem 上安装 Jekyll - 2

    我正在尝试使用本手册让Jekyll在Windows8x64上运行:RunningJekyllonWindows我正在使用来自rubyinstaller.org的以下两个下载:ruby2.0.0-p0(x64)DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe所以我根据手册设置了Ruby和DevKit(希望它是更新的版本)。我尝试运行一点HelloWorld.rb脚本,它工作正常,路径变量已设置。然后我尝试运行geminstalljekyll并得到以下输出:geminstalljekyll-outputonpastebin.com问题似乎出在名为f

随机推荐