我有一个配置了一个MVC4 Web角色的azure解决方案,以及两个后端Web角色。我一直在使用内部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工作?
有关我的环境的更多详细信息:
赢7 x64 | IIS 7.5 |最新版本的Azure SDK
答案 0 :(得分:1)
为了解您的问题,我使用HTTP / 80和Internal-HTTP(端口自动)端点创建了一个MVC4 Web角色,并使用内部TCP端点创建了两个Worker Role。我在每个工作者角色中设置了以下内容:
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解决方案(包括您的完整配置)并在此处分享,我确定可以查看并找到适合您的解决方案。