Requested registry access is not allowed on IIS server while accessing api which is reading shared folder using closedXML library

Nagaraj TV 0 Reputation points
2023-09-12T12:22:26.5866667+00:00
{
    "Message": "An error has occurred.",
    "ExceptionMessage": "The type initializer for 'MS.Utility.EventTrace' threw an exception.",
    "ExceptionType": "System.TypeInitializationException",
    "StackTrace": "   at Deloitte.KMPortal.Repository.SearchKnowledgeRepository.<>c__DisplayClass7_0.<getAdvancedDetails>b__0()\r\n   at Deloitte.KMPortal.Repository.Common.ImpersonationHelper.Impersonate(String domainName, String userName, String userPassword, Action actionToExecute)\r\n   at Deloitte.KMPortal.Repository.SearchKnowledgeRepository.getAdvancedDetails(String ProjectDet, Int32 sector1, Int32 sector2, Int32 sector3, Int32 sector4, Int32 sector5, Int32 sector6, Boolean UniqueStatusValue, Boolean extensiveResearchValue, Boolean isconfidentialValue, String CreatedBy, Int32 selectedGeo, Int32 selectedService, Boolean AddiitionalFilter, Boolean docSearch)\r\n   at Deloitte.KMPortal.API.Controllers.SearchController.getAdvancedDetails(String ProjectDet, Int32 sector1, Int32 sector2, Int32 sector3, Int32 sector4, Int32 sector5, Int32 sector6, Boolean UniqueStatusValue, Boolean extensiveResearchValue, Boolean isconfidentialValue, String createdBy, Int32 selectedGeo, Int32 selectedService, Boolean AddiitionalFilter, Boolean docSearch)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()",
    "InnerException": {
        "Message": "An error has occurred.",
        "ExceptionMessage": "Requested registry access is not allowed.",
        "ExceptionType": "System.Security.SecurityException",
        "StackTrace": "   at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)\r\n   at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)\r\n   at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)\r\n   at MS.Utility.EventTrace.IsClassicETWRegistryEnabled()\r\n   at MS.Utility.EventTrace..cctor()"
    }
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,906 questions
{count} votes

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.