2012-04-15 32 views
3

我正在爲我的MVC3 web應用程序使用ACS身份驗證。它在本地計算機上工作得非常好。但是,當我將此上載到Azure時,出現此錯誤。我設置CopyLocal = True時,請幫助無法在azure上發現程序集「Microsoft.IdentityModel」錯誤

Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.Serialization.SerializationException: Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

回答

1

你Azure的機器可能是缺少這個WIF runtime

+2

是的,Azure機器是以.NET 3.5/4.0爲基礎的Windows 2008或Windows 2008 R2機器。他們沒有像WIF那樣的額外運行時間。 你的應用程序顯然是通過ACS或其他方式進行身份驗證。 請確保通過將「複製本地」屬性設置爲true來爲該dll引用包含此程序集。 – ryancrawcour 2012-04-15 21:34:05

5

更多信息,複製本地,即確保Microsoft.IdentityModel.dll是在bin目錄,將工作,除非你的代碼使用RoleEnvironment API。如果是這種情況,那麼你將遇到以下已知問題:

http://msdn.microsoft.com/en-us/library/windowsazure/hh403974.aspx

在這種情況下,Microsoft.IdentityModel將需要在Azure中虛擬機的GAC存在。要做到這一點,請使用啓動任務。這篇文章介紹了兩種方法來實現:

http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/

+0

啓動任務爲我工作! – 2012-06-20 18:32:07

3

我爲微軟工作。我們刪除了hh403974.aspx中的這篇文章,因爲它的命中率很低,但是我看到它仍然從此線索中獲得了一些引用,所以我將粘貼下面的文章的內容。

無法查找大會「Microsoft.IdentityModel」當RoleEnvironmentAPIs被稱爲

適用於:適用於SDK1.3,然後再使用一個完整的IIS Web角色和Windows身份驗證基礎。

症狀:第一次調用RoleEnvironment方法時遇到以下異常。

[SerializationException:無法找到程序集 'Microsoft.IdentityModel,版本= 3.5.0.0,文化=中性公鑰= 31bf3856ad364e35'。]

原因:Windows標識基礎組件不正確地安裝到Azure的虛擬機。

解決方案:使用啓動任務在虛擬機上重新安裝Windows Identity Foundation package

有關使用啓動任務的更多信息,請參閱Azure中的Run Startup Tasks

+0

鏈接的更新文件不起作用:*安裝程序遇到錯誤:0x80096002。消息簽名者的證書無效或未找到。* – Sheridan 2015-06-16 12:09:11

相關問題