无法在 Azure 上找到程序集"Microsoft.标识模型"错误



我正在为我的 MVC3 Web 应用程序使用 ACS 身份验证。它在我的本地机器上工作得很好。但是当我将其上传到 Azure 时,我收到此错误。 我设置了复制本地=真,请帮忙

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.  

有关此内容的更多信息。复制本地,即。确保 Microsoft.IdentityModel.dll 位于 bin 目录中,除非代码使用 RoleEnvironment API,否则将正常工作。如果是这种情况,那么您将遇到以下已知问题:

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

在这种情况下,Microsoft.IdentityModel 需要存在于 Azure VM 的 GAC 中。为此,请使用启动任务。这篇文章描述了实现此目的的两种方法:

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

我为Microsoft工作。 由于点击率低.aspx我们已经在 hh403974 删除了这篇文章,但我看到它仍然从这个线程中得到了一些推荐,所以我将粘贴下面文章的内容。

调用角色环境 API 时找不到程序集"Microsoft.IdentityModel"

适用于:使用完整的 IIS Web 角色和 Windows 标识基础应用于 SDK1.3 及更高版本。

症状:首次调用角色环境方法时遇到以下异常。

[序列化异常:找不到程序集"Microsoft.标识模型,版本=3.5.0.0,区域性=中性,公钥令牌=31bf3856ad364e35'。

原因:Windows 标识基础程序集未正确安装到 Azure 虚拟机。

解决方法:使用启动任务在虚拟机上重新安装 Windows 标识基础程序包。

有关使用启动任务的详细信息,请参阅在 Azure 中运行启动任务。

Azure 计算机可能缺少 WIF 运行时。

最新更新