Windows error 0x80070542, -2147023550

Detailed Error Information

BAD_IMPERSONATION_LEVEL[1]

MessageEither a required impersonation level was not provided, or the provided impersonation level is invalid.
Declared inwinerror.h

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode7 (0x007)
NameFACILITY_WIN32[2][1]
DescriptionThis region is reserved to map undecorated error codes into HRESULTs.[2][1]
Error Code1346 (0x0542)

This is a Win32 error which has been mapped into an HRESULT. More information may be available in error 0x00000542.

Questions

16votes
2answers

ASP.NET MVC application gives Internal Server Error only when viewed in Firefox

(I'm new to .Net and the Microsoft world in general, coming from a Java and Tomcat background, so please bear that in mind.) I'm working on my first .Net application, using Visual Studio 2013, C#, .Net 4.5, MVC 5, and EF 6. It's a fairly simple web-based application, using Windows [...] read more
.net
asp.net-mvc
firefox
iis
static-files
14votes
3answers

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, [...] read more
c#
compiler-errors
permissions
13votes
2answers

HTTP Error 500.0 on StaticFile when using custom identity for AppPool

I have an MVC4 web application deployed on a Windows 2012 R2 server with IIS 8.5. I configured the Application Pool to run with a custom domain account because the web application needs to call another webservice on the network with Windows authentication enabled. When i try to reach the [...] read more
asp.net-mvc-4
application-pool
internal-server-error
staticfilehandler
11votes
5answers

500 Error when using custom account for application pool in IIS 7

I have a very simple site with only static files in IIS 7 on Windows Server 2008 SP2. When I try to access any static file I get a 500 error. If I rename an html file to have an aspx extension it works fine. The site also works fine [...] read more
iis-7
application-pools
8votes
7answers

Why, when I impersonate within a WCF service, can my service not load System.Transactions when I try to run a LINQ to SQL query?

I have a WCF service, hosted in IIS 7.0 that needs to run database queries. In order to get the right permissions to do this I am impersonating within the service as follows: CODE [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] public void MyOperation(int arg) CONFIGURATION <behavior name="ReceivingServiceBehavior"> <!-- Other behaviors --> <serviceAuthorization impersonateCallerForAllOperations="true" [...] read more
.net
sql-server
wcf
security
transactions
5votes
2answers

IIS 500.0 AuthenticateRequest error for static files

I have tried to setup an website in a new server and I get this error for all static files html/css/js, etc. HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred. enter image description here [https://i.stack.imgur.com/Tkzb5.png] AuthenticateRequest is happening for [...] read more
asp.net
authentication
iis
iis-8
4votes
3answers

How to check if user with [UserName] and [Password] is domain administrator of [DomainName] without impersonation?

Impersonation example I can check is user domain administrator with next lines of code: using (Impersonation im = new Impersonation(UserName, Domain, Password)) { System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent(); bool isDomainAdmin = identity.IsDomainAdmin(Domain, UserName, Password); if (!isDomainAdmin) { //deny access, for example } } where IsDomainAdmin - is extension method public static [...] read more
c#
.net
active-directory
4votes
2answers

WCF - weird error

I have my dll hosted at IIS with wsHttpBinding. I have this weird error happened intermediate. Well, everything will be restored back normal again when I reset the IIS (iisreset). I also read this one http://msdn.microsoft.com/en-us/library/ee517280.aspx. But I am not sure it has to do with this. Please guide me [...] read more
wcf
iis-6
wshttpbinding
3votes
1answer

How do I make sure that my windows impersonation level is valid?

I am dealing with a nasty issue that has me ready to tear my hair out. I have a C# console application that uses Microsoft's HttpListener class to listen for web requests. The idea is that the console application runs in the background as UserAccountA (low priv). UserAccountB (Administrator, etc) [...] read more
c#
visual-studio
impersonation
httplistener
3votes
0answers

LogonUserEx, DuplicateTokenEx for Impersonation with an ObjectContext in C#

We have a particular SQL Server which we need to access from a thick (.Net 4.0 WPF) client, and the only credentials available to us for that connection is a 'service' account which is effectively an Active Directory account with permission on the SQL Server. I am using Entity Framework, [...] read more
c#
impersonation
objectcontext
3votes
2answers

Impersonation error when calling wcf-service

I developed a wcf service. Since it will also be called by non-.net clients, I used basichttpbinding. Some of the methods need Impersonation. This is forced by decorating the webmethods with: [OperationBehavior(Impersonation = ImpersonationOption.Required)] After I deployed the service on our test server, I get a strange error when I [...] read more
wcf
2votes
0answers

Power Query SQL Server connection - authenticate "windows alternative user account"

I am using Excel 2013 PowerQuery addin to connect to SQL Server database. I have Excel open with my user account (domain/Sherlock); which does not have read access to the database (myServer/myDB). I have the credentials for another Windows user account (domain/Sherlock_2), which does have read access. Objective: I would [...] read more
sql-server
excel
authentication
excel-2013
powerquery
2votes
2answers

BAD IMPERSONATION in IIS Express with Basic Auth for all static requests

We are attempting to use Basic Authentication in a project, which generally works fine in our integration and QA environment or even running locally with IIS 7.5. But running locally in IIS Express we get some very strange issues -- any static requests result in cryptic HTTP 500 errors telling [...] read more
asp.net-mvc
impersonation
iis-express
windows-security
2votes
1answer

ASP.net impersonation works on published intranet site but not localhost

So, I have developed a web application in VS 2010 using ASP.net with VB.net code-behind. This web app is hosted on the company server. I use impersonation in IIS to be able to access network files in my web app, but for some reason I have run in to problems. [...] read more
asp.net
.net
visual-studio-2010
impersonation
intranet
2votes
1answer

How do I handle WindowsImpersonationContext with HttpListener?

This may have been asked previously a slightly different way, but I have not yet satisfied myself completely. With Visual Studio 2013, Windows 7, and a small C#/.NET 4.0 project, I am using an HttpListener to build a tiny web server in order to host some simple services and pages. [...] read more
c#
visual-studio
httplistener
2votes
0answers

Entity Framework 6.1 SaveChanges() -> Could not load file or assembly 'System.ComponentModel.DataAnnotations'

Guys I'm out of ideas... Info : * WPF aplication (C#, .net Framework 4.5) * EntityFramework 6.1 * Recreated whole model (even merged from 3 models to 1) * Uninstalled/installed EntityFramework (console and nuget) few times :) Everything works fine if I run it from VS, but when I run [...] read more
c#
.net
wpf
entity-framework
1vote
0answers

How to backup one external drive to another, using a Windows PC with limited permissions?

I have an external drive most of my work is on, and I use it at a work PC running Windows 7 Enterprise with limited permissions (small research team in a big organization). I want to make sure that the 1-2TB data on my main external drive (my 'expansion' drive) [...] read more
backup
permissions
external-hard-drive
1vote
1answer

website error on new server

I have this code running on 8 servers. Now I'm standing up the next 4. I've reproduced this issue on all 4 servers. At first, I get: > System.InvalidOperationException: The view 'Index' or its master was not found > or no view engine supports the searched locations. and it lists [...] read more
asp.net
iis-8.5
1vote
0answers

IIS7 not .html or .js files but serves .aspx

I'm trying to implement authentication into my website. I have managed to be correctly redirected to a login page when I try to access the secured website and I can login. However, the problem is that after login I can't access static files (such as .html, .css, .js, etc.), but [...] read more
windows-server-2008
iis
iis-7
asp.net
.net
1vote
1answer

IIS Custom AD account for app pool and 500 for most static content

I just tried this morning to switch an old ASP.NET site's app pool to one that use an AD account for SQL access, upon doing so most of the static content on the site was unavailable (i.e. some images and the CSS file) with a nice 500. After activating failed [...] read more
active-directory
iis
application-pools
1vote
1answer

IIS 10 - 500 (Internal Server Error)

My website hosted on two environment. Both environment has similar server configuration (Azure VM, Windows server 2016, IIS 10) and same version of code deployed. It was working fine since last one months on both servers but after new release its giving below errors on test02 environment server while in [...] read more
asp.net-mvc
iis
windows-server-2016
iis-10
1vote
1answer

Process Debug Manager (PDM) security issues

I have an issue with all computers in AD: I'm getting this error after creating VBScriptEngine with debugging flag: either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542) The problem is around this line: processDebugManager.AddApplication(debugApplication, out debugApplicationCookie)) where processDebugManager is [...] read more
c#
c++
com
activex
clearscript
1vote
1answer

Can only call SharePoint 2007 web service using WCF client after calling with ASMX Web Reference

I have a web app that calls the SharePoint 2007 Lists.asmx service using a WCF endpoint. In an all day attempt to determine why it was receiving a 500 response when calling the GetListItems method, I discovered that it starts succeeding after I execute a query in U2U Caml Query [...] read more
.net
wcf
web-services
sharepoint-2007
1vote
0answers

Error with static pages (error 0x80070542)

I am getting error 0x80070542 whenever I try to access a static file (such as .html). If I try to access a page like Default.aspx, everything works fine with no errors. Is there any reasonable solution to this problem? I have already seen this answer, however, I don't want to [...] read more
asp.net
iis
iis-7
web-config
1vote
1answer

Error (0x80070542) in website using custom account in application pool

My ASP.NET MVC 3 website was working fine, and then this afternoon I started getting a 500 error, although the only thing I changed was to enable 32-bit applications. I changed that back but the error remains. I've even deleted my app pool and web site and recreated them in [...] read more
asp.net-mvc-3
iis
1vote
2answers

Using Microsoft Virtual Server from C#: CoSetProxyBlanket does nothing

I'm attempting to write a couple of NAnt tasks for interacting with Microsoft Virtual Server 2005 R2 SP1, and I've lifted the code found on "Virtual PC Guy's WebLog", in the "Controlling Virtual Server through PowerShell" post. It doesn't work: I always get a failure when calling CreateVirtualMachine: System.Runtime.InteropServices.COMException (0x80070542): [...] read more
c#
nant
virtual-server
1vote
1answer

how to impersonate client side of wcf call

I need some help about WCF and authorization. Currently I have a client which calls as .NET remoting object hosted in a windows service and which is calling a WCF service (with wshttpbinding). The WCF service is using windows authentication with message based security. The windows service is running with [...] read more
wcf
security
impersonation
0votes
1answer

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

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 [...] read more
asp.net
visual-studio-2019
iis-express
windows-server-2016
iis-express-10
0votes
0answers

MQ client 8.0.0.4 type initializer error when called from ssis script task

While migrating from mq dot client 1.0 to mq 8.0.0.4, receiving following error when call mq manager is made. call is made from a script task from ssis 2012 package. call to mq manager works when called from a windows service. Inner Exception : System.IO.FileLoadException: Could not load file or [...] read more
ibm-mq
ssis-2012
script-task
0votes
1answer

Cannot run app pool as service account

I had a Python Flask website that ran fine when I ran the app pool as my own account. When I tried changing this to a service account (which should have permissions), I get the following error > HTTP Error 500.0 - Internal Server Error > > The page cannot [...] read more
python
iis
0votes
0answers

ASP.net MVC JS file running fine after publishing but fail to load (500 internal server error) in debug on local IIS

In my project, I've a JS file that I've included in the index file at the top of the page. The file contains collection of common jquery functions for events, e.g.: $('#student').click(function () { var url = "../Layout/EditStudent?StdID=" + $(this).attr('data-sid') + '&crsID=' + $(this).attr('data-crsID'); console.info(url); window.location.href = url; }); When [...] read more
asp.net-mvc
0votes
1answer

WCF Impersonation Error Calling ASMX

I have a web app that is calling a WCF Method with Impersonation set as required. In this method, I need to call another web service (ASMX) that returns security groups. The problem is, with the Impersonation set as Required, I get an error when I try to create an [...] read more
c#
web-services
wcf
asmx
impersonation
0votes
1answer

IIS8 refuses to serve up a static .wsdl file

I'm currently facing an issue I've never seen Before. I have a static .wsdl file set in the site directory and if I navigate to the .svc file it shows up just fine, but as soon as I navigate to http://www.foo.bar/service.wsdl to download the WSDL it throws up an Error [...] read more
wcf
iis
wsdl
0votes
0answers

Unhandled Excecution error while debugging project in asp.net mvc5

I am having windows 8.1 and I upgrade it 2 days a go. After upgrading, When I open my visual studio and debug any of my project so I got the error that you can see in last that I have provided. I had also re-installed visual studio 13 but [...] read more
asp.net-mvc-5
0votes
1answer

WCF user identity issue when try to impersonate

I have WCF 3.5 service written by other company but I have source code. I have two clients, first is Silverlight (written by the same company) and second ASP page created by me. I have following error on WCF site: using(((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate()) { SomeClass.SomeMethod(); } The Identity is almost the same. [...] read more
asp.net
.net
wcf
silverlight
impersonation
0votes
0answers

Visual studio 2010 can not debug when user identified information configed in web.config

I am using visual studio 2020 to do the web application development,and our application require high authenciation,so we add the user identified information in the web.config like this: <identity userName="username" password="pass" impersonate="true"/> However,after add these words,I found that I can not go to the debug model. When I hit the [...] read more
visual-studio-2010
0votes
1answer

WCF impersonation exception in ASP.NET

I have a solution in which a Silverlight application calls a WCF service (self-hosted in console application) which we'll call A, which calls another WCF service (hosted in IIS) which we'll call B. WCF service A contains two standard methods and one methods which uses impersonation and calls WCF service [...] read more
asp.net
silverlight
wcf
impersonation
0votes
1answer

Impersonation exception invoking DirectoryEntry.Invoke method

I have a frustrating problem trying to use the System.DirectoryServices.DirectoryEntry.Invoke() method to recycle app pools on a remote IIS server. The basic context is two client machines and an IIS 7.0 server machine (Windows 2008 Server), myServer, all in the same Windows domain. I want to run code on the [...] read more
iis
impersonation
0votes
1answer

Trying to follow WCF delegation example on MSDN but keep getting "impersonation level" exception

Near the bottom of this article (MSDN) in a section entitled "The following code example demonstrates how to use delegation." where MSDN shows an example of how to perform delegation. I have tried to take this example and apply it to my code. In my situation, I have a client [...] read more
wcf

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0