IIS Express: Either a required impersonation level was not provided, or the provided impersonation level is invalid. (0x80070542)

0

I am experiencing a weird issue while testing an Asp.Net Webforms application with Windows authentication & IIS Express.

Here is the context information: OS:

OS Name Microsoft Windows Server 2016 Standard
Version 10.0.14393 Build 14393

Visual Studio 2019:

Microsoft Visual Studio Enterprise 2019
Version 16.4.6
VisualStudio.16.Release/16.4.6+29905.134
Microsoft .NET Framework
Version 4.8.03761

Application: Asp.net WebForms, MVC 5, Web Api 2.0 application with Windows authentication.I use Chrome & FireFox to test the app and IIS Express 10.

I have two windows accounts let's call them Account1 and Account2 under a domain called SomeDomain which is the main domain. Both accounts have Local Administrator privileges on this VM. UAC is enabled on this VM. I do not run Visual Studio as administrator.

When I do development I am logged in as Account1 I don't have any issue with this account. However, when I log in in the application under Account2 (when I am prompted by the browser that is) I get past the default page but then I click on some other pages and I get prompted for password again. Sometimes one page might work and second time I access that page I am prompted for password! Extremely weird. I have to say I never ever had such a problem on previous development VMs, with Windows Server 2012 and Visual Studio 2017.

Now, I started to investigate to see what's going on. First of all, Account2 has read access to the application directory. I double checked that using the Effective Access feature in Windows -> Security dialog.

I checked the IIS Express log file and here is the error:

<EventData>
  <Data Name="ContextId">{8000002A-0001-FA00-B63F-84710C7967BB}</Data>
  <Data Name="ModuleName">IIS Web Core</Data>
  <Data Name="Notification">2</Data>
  <Data Name="HttpStatus">500</Data>
  <Data Name="HttpReason">Internal Server Error</Data>
  <Data Name="HttpSubStatus">0</Data>
  <Data Name="ErrorCode">2147943746</Data>
  <Data Name="ConfigExceptionInfo"></Data>
 </EventData>
 <RenderingInfo Culture="en-US">
  <Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
  <Keywords>
   <Keyword>RequestNotifications</Keyword>
  </Keywords>
  <freb:Description Data="Notification">AUTHENTICATE_REQUEST</freb:Description>
  <freb:Description Data="ErrorCode">Either a required impersonation level was not provided, or the provided impersonation level is invalid.
 (0x80070542)</freb:Description>
 </RenderingInfo>

A search on the web shows that these errors have been plaguing developers for a very long time. But now, 2020?

asp.net
visual-studio-2019
iis-express
windows-server-2016
iis-express-10
asked on Stack Overflow Apr 2, 2020 by costa

1 Answer

1

It turns out that the issue occurred because I was not running VS Studio 2019 as administrator. Once I set that I don't have any issues anymore.

answered on Stack Overflow Apr 2, 2020 by costa

User contributions licensed under CC BY-SA 3.0