Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4085

The remote server returned an error: (404) Not Found error for API calls after server publish

$
0
0

We built an API service using asp.net. The calls work fine on the local machine with IIS Express and port 51937. But we get "The remote server returned an error: (404) Not Found" error when we try to access the API after publishing to the server.

Here is the API project structure

enter image description here

Here is how we are calling the method from console app, just to test it

using Mercury_Api;using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;using System.Text;using System.Threading.Tasks;namespace DemoConsoleApplication{    class Program    {        static void Main(string[] args)        {            string consumerKey = "xxx";            string consumerSecret = "xxxxx";            //var uri = new Uri("http://localhost:51937/MercuryDataConnectivity.svc/GetSidewalksXml/0/0/267");            //var uri = new Uri("http://localhost:51937/MercuryDataConnectivity.svc/GetSidewalksJson/0/0/267");            var uri = new Uri("http://testsite.com/MercuryDataConnectivity.svc/GetSidewalksXml/0/0/267");            string url, param;            var oAuth = new OAuthBase();            var nonce = oAuth.GenerateNonce();            var timeStamp = oAuth.GenerateTimeStamp();            var signature = oAuth.GenerateSignature(uri, consumerKey,            consumerSecret, string.Empty, string.Empty, "GET", timeStamp, nonce,            OAuthBase.SignatureTypes.HMACSHA1, out url, out param);            WebResponse webrespon = (WebResponse)WebRequest.Create(               string.Format("{0}?{1}&oauth_signature={2}", url, param, signature)).GetResponse();            StreamReader stream = new StreamReader(webrespon.GetResponseStream());            Console.WriteLine(stream.ReadToEnd().ToString());            //txtResult.Text = stream.ReadToEnd();            Console.ReadLine();        }    }}

On the local machine both XML and Json methods return values, but on the server we get the not found error.

The website is definitely working as the directory listing works fine, see belowenter image description here

However clicking on any of the files throws the following 404 errorenter image description here

So far I have checked the directory permissions, application pool permissions, tried .Net framework 4.0 and unmanaged code for pool, tried both integrated/classic modes for pool.

Appreciate any help.


Viewing all articles
Browse latest Browse all 4085

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>