簡體   English   中英

Azure應用程序可在開發架構上運行,但在部署時無法運行

[英]Azure app works on dev fabric but not when deployed

我最近將訪問控制服務並入了我們的應用程序。 而且它在開發架構中可以100%正常工作(不會引發任何異常)。 但是,在實際的天藍色網站上運行此文件時,它無法加載該網站。

我已經在整個網站上記錄了調用,並且在OnStart()方法中唯一觸發的是WebRole的開始和結束。 我已經添加了登錄到應該被點擊的控制器的信息,並且從未被調用過。 我還添加了登錄到我的自定義WSFederationAuthenticationModule中覆蓋的“ InitializePropertiesFromConfiguration”方法的記錄,這使我相信它在Web配置(添加自定義STS處理程序等)中執行某些操作時遇到了問題。 下面是我的應用程序的web.config,如果有人知道是什么原因導致此類問題的發生,或者至少可以嘗試一下,我將非常感激。 更糟的是,工作防火牆問題意味着我無法遠程進入azure計算機,以查看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配置需要此問題:因為我已經切換到https

第二個問題與證書的加載有關:

注釋掉這部分代碼,可以正常運行。 它仍然在那里不起作用。 那么,很明顯的問題是它無法加載此證書。 我嘗試通過指紋加載,但無濟於事。 我最好的猜測是,天藍色的storeLocation或storeName不正確。 我已將證書添加到“證書”文件夾中,但找不到它。 我會把這些弄亂並報告。

EDIT2:找到了第二個問題的起因:我忘記將證書添加到Web角色,此站點對於弄清楚該問題提供了很大幫助: http : //blogs.msdn.com/b/jnak/archive/2009/ 12/01 /如何添加HTTP端點到Windows Azure雲服務.aspx

您是否正在使用Windows Identity Foundation?

看看我寫的這篇博客文章,它解釋了我在訪問控制方面遇到的問題。 部署后,您很有可能會在Azure中丟失WIF dll。 WIF的dll必須在GAC中。 您還可以使用Intellitrace找出為什么角色沒有啟動的原因。

http://blog.cloudish.net/the-cloudish-blog/2012/3/28/how-to-install-the-windows-identity-foundation-runtime-on-de.html

關於您的證書問題,確定要將其添加為服務證書而不是管理證書嗎?

您可能還需要簽出Identity Developer培訓套件。 它有一個名為“ Windows Azure中的Web服務和身份”的分步實驗室,該實驗室演示了如何創建和部署WIF支持的網站以實現蔚藍。 您應該查看證書部分,以確保開發架構實例和Azure中的一切都正確無誤。

http://www.microsoft.com/download/zh-CN/details.aspx?displaylang=en&id=14347

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM