Access Denied - Windows API Controller Class

As a continuation from https://stackoverflow.com/questions/48107646/how-to-test-apicontroller ... in short ....

Im working on an existing Windows Service project in VS 2013.

I added an API class ... I called it SynchroniseFromAwsServiceController

I'm trying to call it AWS lambda call, but it tells me that I don't have access. So I need to check it locally to make sure it works, to try to diagnose the problem.

  namespace Workflow { public class SynchroniseFromAwsServiceController: ApiController { //// POST api/<controller> [HttpPost] public string SapCall([FromBody]string xmlFile) { string responseMsg = "Failed Import User"; if (!IsNewestVersionOfXMLFile(xmlFile)) { responseMsg = "Not latest version of file, update not performed"; } else { Business.PersonnelReplicate personnelReplicate = BusinessLogic.SynchronisePersonnel.BuildFromDataContractXml<Business.PersonnelReplicate>(xmlFile); bool result = Service.Personnel.SynchroniseCache(personnelReplicate); if (result) { responseMsg = "Success Import Sap Cache User"; } } return "{\"response\" : \" " + responseMsg + " \" , \"isNewActiveDirectoryUser\" : \" false \"}"; } } } 

I am using PostMan to verify this. Im starts the application in VS and enters http://127.0.0.1/SynchronisePersonnelXmlFromAwsServiceController/SapEaiCall in the POST field in POSTMAN ui ... it returns the following:

Server error in application "/".

Failed to start monitoring changes 'D: \ Development \ Trunk \ WebAppsMVC \ Icon \ Icon \ global.asax' because access is denied. Exception Details: System.Web.HttpException: Failed to start monitoring changes to 'D: \ Development \ Trunk \ WebAppsMVC \ Icon \ Icon \ global.asax' because access is denied.

Stack trace:

 [HttpException (0x80070005): Failed to start monitoring changes to &#39;D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax&#39; 

because access is denied.] System.Web.DirectoryMonitor.AddFileMonitor (String file) +9929663 System.Web.DirectoryMonitor.StartMonitoringFileWithAssert (String file, FileChangeEventHandler callback, string alias) +89 System.Web.FileChangesMonitor.Start alias.Start callback FileChangeEventHandler) +331 System.Web.HttpApplicationFactory.SetupChangesMonitor () +122 System.Web.HttpApplicationFactory.Init () +161 System.Web.HttpApplicationFactory.EnsureInited () +80 System.Weblication.FttPh.Anpht.phttp. System.Web.Compilation.BuildManager.CompileGlobalAsax () +57 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled () +260

 [HttpException (0x80004005): Failed to start monitoring changes to &#39;D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax&#39; 

because access is denied.] System.Web.Compilation.BuildManager.ReportTopLevelCompilationException () +62 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled () +435 System.Web.Compilation.BuildManager.CallAppInebializeHethod.ethod) .HostingEnvironment.Initialize (ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +563

 [HttpException (0x80004005): Failed to start monitoring changes to &#39;D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax&#39; 

because access is denied.] System.Web.HttpRuntime.FirstRequestInit (HttpContext context) +10085904 System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPerterItentper2525 + I4 +)

 [HttpException]: Failed to start monitoring changes to &#39;D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax&#39; 

since access is denied. in System.Web.DirectoryMonitor.AddFileMonitor (String file) in System.Web.DirectoryMonitor.StartMonitoringFileWithAssert (String file, FileChangeEventHandler callback, string alias) in System.Web.FileChangesMonitor.StartMonitoringFileEnd .HttpApplicationFactory.SetupChangesMonitor () in System.Web.HttpApplicationFactory.Init () in System.Web.HttpApplicationFactory.EnsureInited () in System.Web.HttpApplicationFactory.SetupFileChangeNotifications () in System.Webbal.lobal .Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled () [HttpException]: Could not start monitoring changes in 'D: \ Development \ Trunk \ WebAppsMVC \ Icon \ Icon \ global.asax' because access is denied. in System.Web.Compilation.BuildManager.ReportTopLevelCompilationException () in System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled () in System.Web.Compilation.BuildManager.CallAppInitializeMethod () in System.WebMmentostingmementager IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) [HttpException]: Could not start monitoring changes to 'D: \ Development \ Trunk \ WebAppsMVC \ Icon.ax Icon is not allowed. in System.Web.HttpRuntime.FirstRequestInit (HttpContext context) in System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext context) in System.Web.HttpRuntime.ProcessRequestNotificationPrivate (IIS7WorkerRequestCon context)

Does anyone have an idea or can point me in the right direction why I am returning <title>Failed to start monitoring changes to 'D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax' because access is denied.</title>

UPDATE

Thanks https://stackoverflow.com/questions/4889297/failed-to-start-monitoring-changes-on-global-asax-net-3-5-web-service-using-imp

Ive removed only read from the folder and added Authenticated Users. Now when I start, it gives me another error, but still says that access is denied .... Am I using the correct URL? http://127.0.0.1/SynchronisePersonnelXmlFromAwsServiceController/SapEaiCall

In any case, a new error:

Server error in application "/". Access denied. Description: An error occurred while accessing the resources needed to service this request. The server may not be configured to access the requested URL.

Error message 401.2 Unauthorized: Login failed due to configuration server.

Make sure you have permission to view this directory or page based. by the credentials provided and the authentication methods enabled on the web server. Contact your web server administrator for further assistance.

 any help would be much appreciated thank you 

UPDATE Thanks to George Vowos for the reply. I translated http to the above method and changed the signature by turning on the controller.

In postman, I also included a basic value tag for authorization.

Now, when I launch the VS application locally and try to connect through the mail person using http://localhost/WebServices.Workflow/SynchroniseFromAwsServiceController/SapCall

(WebServices.Workflow is the name of the application)

I get the following message:

 Could not get any response There was an error connecting to http://localhost/WebServices.Workflow/SynchroniseFromAwsServiceController/SapEaiCall Why this might have happened: The server couldn't send a response: Ensure that the backend is working properly Self-signed SSL certificates are being blocked: Fix this by turning off 'SSL certificate verification' in Settings > General Proxy configured incorrectly Ensure that proxy is configured correctly in Settings > Proxy Request timeout: Change request timeout in Settings > General 

I tried to disable SSL ... any other ideas?

NEW UPDATE Following the message, I found that I restarted PostMan and restarted POST again, and now the message returns There is a duplicate 'exceptionless' section defined , what I get, I try to run the application from visual studio. So at least it's a step in the right direction (I think) ... I wrote a new question about it ...

mark configuration file as duplicate Exclusive package

NOTE , if someone can help me answer this Q continuation, I will reward them with a reward from this Q. NOTE

Thanks for any answers.

+5
source share
2 answers

I also had the same error when deploying my ASP.Net Web API recently on my machine. I was mistaken in that I did not use the application development functions necessary for this. You also need to check if the following functions are available on your local machine: enter image description here

You can go to ControlPanel → Programs → Programs and Features → Enable or disable Windows features to chekc if these features are enabled or not.

Hope this helps.

+4
source

You need to add integrated Windows authentication to IIS. Check if it is installed:

Start> Run> inetmgr Click Authentication

enter image description here

If Windows Integrated is missing, you need to install it as follows:

On the client OS:
Start> Run> appwiz.cpl
Click Enable or Disable Windows Features
Scroll down to Internet Information Services and expand it
Expand World Wide Web Services
Expand Security
Check authentication methods (Windows Integrated)

On server OS:
Go to server manager (start-> Administrative tools-> Server Manager)
Deploy Roles and Web Server (IIS)
Scroll down to the role services and click "Add Role Services" on the right. Include all the types you need in the security section

+1
source

Source: https://habr.com/ru/post/1274518/


All Articles