MS.Utitlity.Event Error while uploading SPFx app to AppCatalog

Vivek Agrawal 21 Reputation points
2021-12-08T04:04:50.427+00:00

I try to add a spfx app(.sppkg file) to SharePoint 2019 on-premise appcatalog. and got the error

Invalid SharePoint App package. Error: The type initializer for 'MS.Utility.EventTrace' threw an exception

Using ULS LogViewer, I found following error stacktrace

Unexpected App Packaging: CreatePackage: Unexpected exception: System.TypeInitializationException: The type initializer for 'MS.Utility.EventTrace' threw an exception. ---> > > > System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled() at MS.Utility.EventTrace..cctor()
--- End of inner exception stack trace --- at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID) at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
at Microsoft.SharePoint.Utilities.SPAppFileSystemUtility.<>c__DisplayClass10.b__f()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Utilities.SPAppFileSystemUtility.ElevateToReadPackage(String filePath)
at Microsoft.SharePoint.Packaging.SPPackageFactory.CreatePackage(Stream stream, Boolean extract) 67cd01a0-63da-20aa-cc56-871fd3bad25c

This is working in most SharePoint 2019 environment except one.

UAC(User access control) is set to low on SharePoint server and also checked permission on the default regkey for officeserver at HKLM:\Software\Microsoft\OfficeServer\16 and everything looks good.

Thanks

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Server Development
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2021-12-08T06:53:36.093+00:00

    Hi @Vivek Agrawal ,
    This is usually caused by IIS anonymous authentication. If your iis web Application Settings enabled aspnet:AllowAnonymousImpersonation and IIS authentications enabled Anonymous Authenticaion & Asp.net Impersonate, your web app will access HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics by user specified in IIS Authentications -> Anonymous Authentication -> Specific User, you should make sure this user(IUSR) has read permission to the registry key. You can try to grant "Everyone" read access on that specific key. You can also disable aspnet:AllowAnonymousImpersonation or disable Asp.net Impersonate.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.