简体   繁体   English

网站尝试访问数据库或任何其他站点时,出现“ HTTP错误404。找不到请求的资源。”

[英]“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. 我正在使用Ultidev,并且可以正常访问网站。 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 但是,当它尝试访问托管在与该网站托管在同一台服务器/计算机上的数据库时..或者如果我的网站尝试对其他网站执行ping操作(我构建的功能)..我一直收到此错误

HTTP Error 404. The requested resource is not found. HTTP错误404。找不到请求的资源。

Though I can use a "GET" from a different ServiceStack REST API IP which is weird. 尽管我可以使用来自另一个ServiceStack REST API IP的“ GET”,这很奇怪。

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 这不起作用(返回404)..但这在本地确实起作用

[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: 这既不起作用,但是当我在本地运行它时也再次起作用。返回404,如果我进入DOS并尝试自己,我可以ping它试图ping的地址:

[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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 本地主机上的 ASP.NET MVC Visual Studio http 404 错误,找不到资源。 - ASP.NET MVC visual studio http 404 error on local host, The resource cannot be found. “/”应用程序中的服务器错误。 无法找到该资源。 (404) 将 WCF 服务部署到 Azure 应用服务时 - Server Error in '/' Application. The resource cannot be found. (404) when deploying WCF service to Azure App Service 尝试在IIS 8.5上使用HTTPS访问目录但无法使用HTTP时,找不到404服务器错误资源 - Server Error Resource cannot be found 404 when trying to access directory using HTTPS on IIS 8.5 but works using HTTP 应用程序“/”中的服务器错误。 HTTP 404.MVC ASP.NET - Server error in application '/'. HTTP 404. MVC ASP.NET 找不到引发HTTP 404的IIS,但是资源存在。 要求的网址也会自动更改。 - IIS throwing HTTP 404 not found but resource exists. Requested URL also changing automatically.! 无法找到该资源。 要求的网址:/login.aspx - The resource cannot be found. Requested URL: /login.aspx 无法找到该资源。 要求的网址:/ Area / Controller / undefined - The resource cannot be found. Requested URL: /Area/Controller/undefined 描述:HTTP 404。您正在寻找的资源(或其依赖项之一)可能已被删除, - Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, 找不到资源 HTTP 404 错误 | 微博 | 家庭控制器.cs - The resource cannot be found HTTP 404 Error | HttpPost | HomeController.cs WEB API错误404-“消息”:“请求的资源不支持http方法&#39;PUT&#39;。” - WEB API error-404 - “Message”: “The requested resource does not support http method 'PUT'.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM