-1

Im running a C# workflow application.

I've added an aspx page UserUpdate.aspx

Also added a web api controller SynchronisePersonnelXmlFromAwsServiceController.cs

Using postman on a POST call if I enter

http://localhost/Workflow/RefreshPersonnel.aspx

I get the correct response the page is displayed in html.

However If I try to call the function TestCall() in the SynchronisePersonnelXmlFromAwsServiceController.cs page with the following call

http://localhost/Workflow/SynchronisePersonnelXmlFromAwsServiceController/TestCall

I get a 404 not found -

<legend>Error Summary</legend>
<h2>HTTP Error 404.0 - Not Found</h2>
<h3>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.</h3>


  <legend>Most likely causes:</legend>
                <ul>
                    <li>The directory or file specified does not exist on the Web server.</li>
                    <li>The URL contains a typographical error.</li>
                    <li>A custom filter or module, such as URLScan, restricts access to the file.</li>
                </ul>
            </fieldset>
        </div>
        <div class="content-container">
            <fieldset>
                <legend>Things you can try:</legend>
                <ul>
                    <li>Create the content on the Web server.</li>
                    <li>Review the browser URL.</li>
                    <li>Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click 

code is as follows:

   namespace Workflow
{

    public class SynchroniseFromAwsServiceController: ApiController
    {
        //// POST api/<controller>
        [HttpPost]
        public string TestCall()
        {
            string xmlFile = "Test XML Test";
            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 \"}";
        }
}
}
John
  • 3,965
  • 21
  • 77
  • 163

2 Answers2

0

http://localhost/Workflow/SynchronisePersonnelXmlFromAwsService/TestCall

Please remove Controller of SynchronisePersonnelXmlFromAwsServiceController like above.

quangminhs
  • 151
  • 5
  • thank you for the reply but this did not resolve the issue – John Jan 15 '18 at 02:55
  • What is port run? – quangminhs Jan 15 '18 at 03:14
  • you try http://localhost/api/SynchronisePersonnelXmlFromAwsService/TestCall – quangminhs Jan 15 '18 at 03:43
  • Havent touched the port but if its working for http://localhost/Workflow/RefreshPersonnel.aspx, surely the port is correct? – John Jan 15 '18 at 04:21
  • Ive tried localhost/api/SynchronisePersonnelXmlFromAwsService/TestCall and it is returning a Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) error. Ive reinstalled Update-Package –reinstall Newtonsoft.Json from https://stackoverflow.com/questions/22507189/could-not-load-file-or-assembly-newtonsoft-json-version-4-5-0-0-culture-neutr but still flagging – John Jan 15 '18 at 04:22
0

Just make sure you have installed the following feature in IIS and then try again.

enter image description here

Kashif
  • 40
  • 2