Could not load file or assembly 'Microsoft.IdentityModel
Asked Answered
R

4

11

I have developed a SharePoint provider hosted (MVC) app and hosted web application in iis of azure VM (WIN SERVER 2012).

When we try to use application using an app, It throws below error.

enter image description here

Server Error in '/' Application.

Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I have already installed dotNet 3.5 and 4.5 in the server. still having the same error. can anyone help me?

Refurbish answered 30/1, 2017 at 13:51 Comment(0)
M
10

You need Windows Identity Foundation either installed on your server or in your project.

Maddox answered 30/1, 2017 at 14:15 Comment(1)
In Windows Server 2012, It already carried dotNet 4.5 and 3.5 with OS. So no need to manually install and just we can enable the feature for them. Anyway, thank you for your kind help.Refurbish
S
4

Go to Search – look for Windows feature in Settings

Windows feature

Check the Windows Identity Foundation 3.5 option.

Windows Identity Foundation 3.5

Restart the machine and we are done.

Skillless answered 2/12, 2022 at 18:7 Comment(0)
R
3

Thanks for people who response to me. I could resolve the error. It was the missing assembly in my project.

Refurbish answered 31/1, 2017 at 5:59 Comment(1)
WHICH assembly? I updated some assemblies and now have a similar problem.Entomology
E
2

It happens because of Broken permissions on file Microsoft.IdentityModel.dll

Solution is;

Add the following 3 entries to %plesk_dir%\etc\DiskSecurity\DiskSecurity.xml file:

<Entry AccounType="1" Account="Psaadm" Path="{ProgramFilesX86}" 
SubPath="Reference Assemblies" AceFlags="ThisFolderSubfoldersAndFiles" 
AccessMask="NoAccess" EntryFlags="0" /> 
<Entry AccounType="1" Account="Psacln" Path="{ProgramFilesX64}" 
SubPath="Reference Assemblies" AceFlags="ThisFolderSubfoldersAndFiles" 
AccessMask="NoAccess" EntryFlags="0" /> 
<Entry AccounType="1" Account="Psaadm" Path="{ProgramFilesX64}" 
SubPath="Reference Assemblies" AceFlags="ThisFolderSubfoldersAndFiles" 
AccessMask="NoAccess" EntryFlags="0" />

below the following entry:

<!-- Program Files\\Reference Assemblies --> 
<Entry AccounType="1" Account="Psacln" Path="{ProgramFilesX86}" 
SubPath="Reference Assemblies" AceFlags="ThisFolderSubfoldersAndFiles" 
AccessMask="NoAccess" EntryFlags="0" />
Edythedythe answered 19/7, 2017 at 23:16 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.