Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'Microsoft.CSharp' when logged in with user which is not a member of administrator group

I have created a website which compiles successfully when I log-in using administrator but when I log-in using any other user, following error occurs.

Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)

The administrator user is member of

  • Acronis Remote Users
  • Administrators
  • Remote Desktop Users

while the other user is member of

  • Acronis Remote users
  • Administrators *
  • IIS_IUSRS
  • Remote Desktop Users
  • SQLServerMSSQLUser$vm-tmp-abcd-1$MSSQLSERER
  • Users

I am using
Windows Server 2008 R2 Enterprise with 64-bit Operating System

  • Initially the other user didn't belong to administrators group. I added the administrators role to it but still I am getting the same error.

NOTE: It compiles the website successfully if I choose VS2010 to run as administrator.

like image 954
fiqbal Avatar asked Jun 18 '12 07:06

fiqbal


1 Answers

This one solved my problem.

  1. Right click on Visual studio (whichever version you use)
  2. Properties
  3. Select compatibility tab
  4. Fill the checkbox which says "Run this program as administrator"
  5. Open the project from the file location
  6. Run the application
like image 135
CoffeeSipper Avatar answered Nov 01 '22 03:11

CoffeeSipper