【问题标题】:Azure "role discovery data is unavailable" error when switching from IISExpress to full IIS从 IISExpress 切换到完整 IIS 时出现 Azure“角色发现数据不可用”错误
【发布时间】:2015-07-15 12:10:37
【问题描述】:

我有一个配置有一个 MVC4 Web 角色和两个后端 Web 角色的 azure 解决方案。我一直在使用内部 http 端点在 IISExpress 上对此进行测试。这很好用。我现在想测试 tcp 端点,因为我们可能会在 Azure live 上使用这些端点,所以我更改了部署选项以使用完整的 IIS,因为据我了解,IISExpress 不支持 tcp 绑定。我尚未对端点进行任何更改,或更改有关部署的任何其他内容。这会导致角色环境初始化失败,并出现“角色发现数据不可用错误”。我在输出窗口中有这个:

\Microsoft.Data.Services.Client\v4.0_4.99.2.0__31bf3856ad364e3 
\Microsoft.Data.Services.Client.dll', Skipped loading symbols. Module is optimized and the   
debugger option 'Just My Code' is enabled.
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_32\msshrtmi  
\1.7.0.0__31bf3856ad364e35\msshrtmi.dll'
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALIZING
Microsoft.WindowsAzure.ServiceRuntime Information: 100 : Role environment . INITIALED RETURNED.  
HResult=-2147467259
Microsoft.WindowsAzure.ServiceRuntime Error: 102 : Role environment . FAILED TO INITIALIZE
A first chance exception of type 'System.InvalidOperationException' occurred in    
Microsoft.WindowsAzure.ServiceRuntime.dll

我的所有实例都是可见的,无论是作为 IIS 下的站点还是在计算模拟器中。我在模拟器诊断中没有看到任何异常情况,对于 MVC4 Web 角色来说是这样的,对于 WCF 服务来说也是类似的:

[fabric] Role Instance: deployment17(123).Azure.Web.Test.0
[fabric] Role state Unhealthy
[Diagnostics]: UpdateState(Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorStartupInfo,    
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration, )
[Diagnostics]: Acquired mutex
[Diagnostics] Information: C:\Users\User\AppData\Local\dftmp\Resources\5911e3b3-15ce-4b36-ab50-
f04dda461e60\directory\DiagnosticStore\Monitor
[Diagnostics] Information: D:\Work\CLIENTS\Test\Solutions\Test\Azure\csx\Debug\roles\Web.Test
\diagnostics\x64\monitor\MonAgentHost.exe -LocalPath "C:\Users\User\AppData\Local\dftmp\Resources
\5911e3b3-15ce-4b36-ab50-f04dda461e60\directory\DiagnosticStore\Monitor" -StaticConfigFile 
"C:\Users\User\AppData\Local\dftmp\Resources\5911e3b3-15ce-4b36-ab50-f04dda461e60\directory
\DiagnosticStore\Monitor\Configuration\mastaticconfig.xml" -ConfigFile "C:\Users\User\AppData
\Local\dftmp\Resources\5911e3b3-15ce-4b36-ab50-f04dda461e60\directory\DiagnosticStore\Monitor
\Configuration\maconfig.xml" -ShutDownEvent WADDM-ShutDown-38fb5936e7b14b058ae4a7c0b516945d 
-InitializedEvent WADM-StartUp-38fb5936e7b14b058ae4a7c0b516945d -parent 15308 -events
[Diagnostics]: Creating config channel server
[MonAgentHost] Output: Agent will exit when WADDM-ShutDown-38fb5936e7b14b058ae4a7c0b516945d is 
signaled.
[MonAgentHost] Output: Will signal WADM-StartUp-38fb5936e7b14b058ae4a7c0b516945d after the agent 
is initialized.
[MonAgentHost] Output: Registered as an event consumer.
[MonAgentHost] Output: Agent will exit when parent process 15308 exits.
[MonAgentHost] Output: Monitoring Agent Started
[Diagnostics]: Starting configuration channel polling
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()

知道是什么原因造成的吗?是否有进一步的配置步骤可以让 IIS 完全正常工作?

关于我的环境的更多细节:

Win 7 x64 | IIS 7.5 |最新版本的 Azure SDK

【问题讨论】:

  • 你在哪里遇到这个错误?根据诊断跟踪,该角色已成功启动。请尝试调试您的应用程序,看看是否能找到更多信息。
  • 感谢您抽出宝贵时间发表评论。我有一个控制器,它在调用开始时使用以下代码: var endpoints = RoleEnvironment.Roles["UtilitiesRole"].Instances.Select(i => i.InstanceEndpoints["HttpInternal"]).ToArray(); - 只要我在 IISExpress 中托管,它就可以正常工作。如果我切换到完整的 IIS7.5,它会失败,并出现上述错误。
  • 你能解决这个问题吗?如果是,怎么做?
  • 不,从来没有。最终只在该项目上使用 http 并使用 iis express 进行测试。

标签: azure


【解决方案1】:

为了理解您的问题,我创建了一个带有 HTTP/80 和 Internal-HTTP (port-auto) 端点的 MVC4 Web 角色和两个带有内部 TCP 端点的 Worker 角色。我在每个工人角色中设置了以下内容:

var endpoints = RoleEnvironment.Roles["WorkerRole1"].Instances.Select(i => i.InstanceEndpoints["EndPoint11"]).ToArray();

var endpoints = RoleEnvironment.Roles["WorkerRole2"].Instances.Select(i => i.InstanceEndpoints["EndPoint12"]).ToArray();

以及 MVC4 HomeController 中的以下内容:

var endpoints = RoleEnvironment.Roles["MVCWebRole1"].Instances.Select(i => i.InstanceEndpoints["HttpInternal"]).ToArray();

我可以使用 IISExpress 和 IIS7.5 运行这个场景,没有任何问题。

如果您只是创建一个显示问题的 helloworld VS2010 解决方案(包括您的完整配置),并在这里分享,我当然可以查看并为您找到解决方案。

【讨论】:

  • 我现在的配置和你的不一样。我有 MVC 角色和两个 Web 角色(不是工作人员),监听内部 http 端口。我目前正处于最后期限,但我会尽快整理您建议的 hello-world 解决方案,并进行报告。目前,只要我在 IISExpress 中托管,一切正常。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-18
  • 1970-01-01
  • 1970-01-01
  • 2015-12-04
相关资源
最近更新 更多