Partager via


Windows Azure | Unable to Find Assembly 'Microsoft.IdentityModel'

Have you encountered the following exception when you browse to your application running on Windows Azure platform.

Unable to find assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

=================================================================================================================

Cause: The Windows Identity Foundation assemblies are not properly installed to the Windows Azure virtual machine.

Resolution: Use a startup task to reinstall the Windows Identity Foundation package on the virtual machine.

 

1.  Download the WIF.msu file from this link : https://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17331 

     Windows6.1-KB974405-x64.msu (Windows Server 2008 R2) for osFamily ="2"

     Windows6.0-KB974405-x64.msu (Windows Server 2008) for osFamily ="1"

 

2.  osFamily property can be set in serviceconfiguration file.

     osFamily="2" - Specifies the OS family that is substantially compatible with Windows Server 2008 R2.

     osFamily="1" - Specifies the OS family that is substantially compatible with Windows Server 2008 SP2.

     Please refer this link: https://msdn.microsoft.com/en-us/library/windowsazure/ee758710.aspx

      

 

3.  Add the WIF.msu to your project and set “Copy to Output Directory Always” to “Copy Always”.

     Run a MSU update package using the following startup task.

     Note : Use Windows6.1-KB974405-x64.msu package if you specify osFamily="2"

               Use Windows6.0-KB974405-x64.msu package if you specify osFamily="1"

     (RegisterDLL.cmd and set copy local = true)

                   @echo off

                   sc config wuauserv start= demand

                   wusa.exe "Windows6.1-KB974405-x64.msu" /quiet /norestart

                   sc config wuauserv start= disabled

                   exit /b 0

 

    

     

4.  Add the below script in the serviceDefinition file.

     <Startup>

           <Task commandLine="RegisterDLL.cmd" executionContext="elevated" taskType="simple" />

     </Startup>

    

Deploy the package on windows Azure platform.

Do a remote desktop to the VM and you will notice that "Microsoft.IdentityModel" assembly is available in GAC.

    

 

Refer the below link :

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

=================================================================================================================

Comments

  • Anonymous
    May 06, 2012
    I managed to do a remote desktop to the VM.  How do you list all the assemblies available in GAC in remote desktop? Thanks.
  • brian
  • Anonymous
    June 05, 2012
    Follow the below steps to list all the assemblies available in GAC: Start -> Run -> Cmd -> assembly

  • Anonymous
    April 25, 2013
    Hi, My azure VM is running with Windows Server 2012. Will this solution will also work for Windows Server 2012(I believe Windows Identity Foundation is built into Windows Server 2012). If yes then what changes I will have to make ? If not then what will be the other solution ? Thanks in Advance, Mahesh