我最近將Access Control Service納入我們的應用程序。它在開發結構中100%正常工作(沒有任何異常被拋出)。但是,在實際的天藍色網站上運行時,它無法加載網站。Azure應用程序適用於開發架構,但不適用於部署
我已經在整個網站的日誌記錄調用中添加了,並且只有在FireStart()方法的WebRole的開始和結束時纔會觸發。我已經將日誌記錄添加到應該打的控制器中,並且永遠不會調用它。我還將日誌記錄添加到在我的自定義WSFederationAuthenticationModule中重寫的「InitializePropertiesFromConfiguration」方法中,這導致我相信它在web配置中執行某些操作時遇到了問題(添加了我的自定義STS處理程序等)。下面是我的應用程序的web.config,如果任何人有任何想法可能會導致這樣的問題,甚至至少有東西要嘗試,我會非常感激。更糟糕的是,工作防火牆問題意味着我無法遠程訪問蔚藍的機器,以查看向Windows日誌拋出什麼錯誤。我不知道可能是什麼問題。
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<globalization culture="en" uiCulture="en"/>
<httpRuntime requestValidationMode="2.0" />
<authentication mode="None" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="TBX.Common.Web"/>
<add namespace="TBX.Pulse.Web"/>
</namespaces>
</pages>
<httpModules>
<add name="WSFederationAuthenticationModule" type="TBX.Pulse.Web.Authentication.CustomWSFederationAuthenticationModule, TBX.Pulse.Web"/>
<add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="WSFederationAuthenticationModule" type="TBX.Pulse.Web.Authentication.CustomWSFederationAuthenticationModule, TBX.Pulse.Web" preCondition="managedHandler"/>
<add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="TBX.Pulse.Web.Scripts.ButtonClickAnimationAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
<extensions>
<behaviorExtensions>
<add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</behaviorExtensions>
</extensions>
<protocolMapping>
<add scheme="http" binding="ws2007FederationHttpBinding" />
</protocolMapping>
<bindings>
</bindings>
</system.serviceModel>
<microsoft.identityModel>
<service>
<claimsAuthorizationManager type="TBX.Pulse.Web.Authorization.CustomClaimsAuthorizationManager" />
<claimsAuthenticationManager type="TBX.Pulse.Web.Authentication.CustomClaimsAuthenticationManager" />
<securityTokenHandlers>
<remove type="Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add type="TBX.Pulse.Web.Authentication.CustomSecurityTokenHandler, TBX.Pulse.Web"/>
</securityTokenHandlers>
<certificateValidation certificateValidationMode="None" />
<serviceCertificate>
<certificateReference x509FindType="FindBySubjectName" findValue="PulseLoginCert" />
</serviceCertificate>
</service>
</microsoft.identityModel>
</configuration>
編輯: 這個折騰了之後,我發現2個問題,一是我已經固定一個仍留待解決: 的第一個問題是,web配置需要這樣的: 因爲我「VE切換到https
第二個問題與證書中裝載的事:
註釋掉的代碼這一部分,它運行良好。它仍然存在,它不起作用。最明顯的問題是它無法加載這個證書。我試過用thumbprint加載,而沒有用。我最好的猜測是storeLocation或storeName在azure上不正確。我已將證書添加到「證書」文件夾中,但無法找到它。我會惹惱這些並報告回來。
EDIT2: 找到的第二個問題的原因: 我忘了證書添加到Web角色,這個網站是一個很大的幫助,以找出答案: http://blogs.msdn.com/b/jnak/archive/2009/12/01/how-to-add-an-https-endpoint-to-a-windows-azure-cloud-service.aspx
我也想指出的是,最好的方法來診斷Azure中的一個問題是使用的IntelliTrace VS試圖RDP到虛擬服務器。 – Zoltan 2012-03-30 16:46:59
我以前從來沒有聽說過Intellitrace,我得仔細研究一下。感謝那! – 2012-03-30 20:11:57
Intellitrace在VS2010中出現,它非常甜! – Zoltan 2012-04-02 14:14:06