简体   繁体   中英

“HTTP Error 404. The requested resource is not found.” when website tries to access database or any other site

Help! I have to present this website really soon and I dont know what to do. I'm using Ultidev and I can access the website just fine. But when it tries to access the database that's hosted on the same server/computer that the website is being hosted on.. or if my website tries to ping other websites (a feature i built).. i keep getting this error

HTTP Error 404. The requested resource is not found.

Though I can use a "GET" from a different ServiceStack REST API IP which is weird.

This works:

 service.getNFLGames = function (season, week, seasonType) { if (season && week && seasonType) { var deferred = $q.defer(); $http.get(http://<SAME IP AS THE HOST>/foundationservice + '/nflgame?' + 'season=' + season + '&week=' + week + '&seasontype=' + seasonType + '&format=json') .success(function (data) { deferred.resolve(data); }).error(function () { deferred.reject('There was an error getting NFL game list.'); }); return deferred.promise; } }; 

this doesn't work (returns 404) .. but this does work locally

[HttpPost]
    public JsonResult GetPlayerMPHTable()
    {
        using (Entities db = new Entities())
        {
            try
            {
                var entries = (from pages in db.foundationPlayerMPHs
                               select pages).ToList();
                return Json(entries);
            }
            catch (Exception ex)
            {
                return Json(null);
            }
        }
    }

This doesn't work neither but again works when i run it locally..returns 404 and i can ping the addresses it's trying to ping if i go into DOS and try myself:

[HttpPost]
    public long PingIP(string ip)
    {
        try
        {
            Ping ping = new Ping();
            PingReply pingResult = ping.Send(ip);

            if (pingResult.Status == 0)
                return pingResult.RoundtripTime;
            else
                return -1;
        }
        catch (Exception ex)
        {
            return -1;
        }
    }

What's also weird is i hosted it before.. and it all worked fine. the one thing i did change was i did a refresh on the database to update a database model. But i mean.. it's hosted on the same friggin computer i dont understand what's going on

here's my connection string as well

<add name="Entities" connectionString="metadata=res://*/Database.Foundation.csdl|res://*/Database.Foundation.ssdl|res://*/Database.Foundation.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=IP HERE;initial catalog=Foundation-NFL;persist security info=True;user id=USERNAMEHERE;password=PASSWORDHERE;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

尝试这个

 return Json(entries, JsonRequestBehavior.AllowGet);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM