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 &
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 &
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 &
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 'D:\Development\Trunk\WebAppsMVC\Icon\Icon\global.asax'
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:
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.