标签: http-error

服务器关闭时出现什么异常或http状态代码

我想监视WCF服务器,并在服务器关闭时发送电子邮件通知。为此,我正在编写一个控制台应用程序,以定期向服务器发送虚拟请求,并检查是否将响应发送回去。控制台应用程序收到异常后,服务器将出现问题,包括服务器已关闭。

但是,问题是我在服务器的不同状态下收到了不同的异常。以下是服务器处于不同状态时从服务器返回的异常。但是,所有这些似乎都属于服务器故障类别。任何的想法??:

IIS关闭时

System.ServiceModel.EndpointNotFoundException,

消息:
http://localhost/service.svc上没有侦听终结点的端点可以接受该消息。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参见InnerException(如果存在)。

内部异常消息:远程服务器返回错误:(404)找不到

当一个Web.config文件被故意更改为错误的名称:

System.ServiceModel.ServiceActivationException
链接: http://localhost/service.svc
消息:
无法激活请求的服务'http://localhost/service.svc'。请参阅服务器的诊断跟踪日志以获取更多信息。

由于其他未知原因

System.ServiceModel.ServerTooBusyException
消息:
位于http://localhost/service.svc ' 的HTTP服务太忙。
消息:
远程服务器返回错误:(503)服务器不可用。

更新1

异常并不总是返回http状态代码。

更新2 除了使用WCF代理调用服务之外,我还必须使用WebRequest,如下所示:

       try
        {
            WebRequest webRequest = WebRequest.Create(uri);
            webRequest.Method = "GET";

            HttpWebResponse httpWebResponse = (HttpWebResponse)webRequest.GetResponse();                             

        }
        catch ()  //what excpetion will tell me server is down??
        {
           ...
        }
Run Code Online (Sandbox Code Playgroud)

.net c# wcf exception-handling http-error

5
推荐指数
1
解决办法
3784
查看次数

HTTP 错误 414 - 请求的 URI 太长/base64 图像

我试图将 base64 编码的图像从托管 XML 文件提取到我的 jQuery 移动应用程序中,但出现此错误。

无法加载资源:服务器响应状态为 414(请求 URI 太长)

我知道对于 URL,缩短它们可以修复错误,但我无法缩短 base64 字符串。

有什么办法解决这个问题吗?

xml base64 uri http-error jquery-mobile

5
推荐指数
1
解决办法
5153
查看次数

Plupload Error -200 HTTP错误

我试图在远程服务器上移动上传.在我选择一个带有以下代码的文件并单击上传文件IS上传后,但是错误返回说代码:" - 200"消息:"HTTP错误"

       var uploader = new plupload.Uploader(
       {
           runtimes : 'html4, html5, flash, silverlight',
           browse_button : 'bt_browse',
           container: document.getElementById('container'),
           url : 'http://remote.com/upload.php',
           silverlight_xap_url : 'js/Moxie.xap',
           chunks_size: '20mb',
           max_retries: 3,
           filters : {
           max_file_size : '100mb'
       },
       multi_selection : true,  
       init: {
         PostInit: function() {
              document.getElementById('filelist').innerHTML = '';
              document.getElementById('bt_uploadfiles').onclick = function() {
                    uploader.start();
                    return false;
              };
         },
         FilesAdded: function(up, files) {
            plupload.each(files, function(file) {
                  //build list
    }},
         UploadProgress: function(up, file) {
         $("#progressBar"+file.id).val(Math.round(file.percent));
            if(Math.round(file.percent)==100){
                $("#progressBar"+file.id).hide();
                $("#deleteFile" + file.id).hide();
            }
         },
         FileUploaded: …
Run Code Online (Sandbox Code Playgroud)

cross-domain http-error plupload

5
推荐指数
1
解决办法
3523
查看次数

Python get 引发 HTTPError 400 Client Error,但手动访问 URL 后,get 暂时有效

当我在 iPython (Python 2.7) 中运行此代码时:

from requests import get
_get = get('http://stats.nba.com/stats/playergamelog', params={'PlayerID': 203083, 'Season':'2015-16', 'SeasonType':'Regular Season'})
print _get.url
_get.raise_for_status()
_get.json()
Run Code Online (Sandbox Code Playgroud)

我正进入(状态:

http://stats.nba.com/stats/playergamelog?PlayerID=203083&Season=2015-16&SeasonType=Regular+Season
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-5-8f8343b2c4cd> in <module>()
      1 _get = get('http://stats.nba.com/stats/playergamelog', params={'PlayerID': 203083, 'Season':'2015-16', 'SeasonType':'Regular Season'})
      2 print _get.url
----> 3 _get.raise_for_status()
      4 _get.json()

/Library/Python/2.7/site-packages/requests/models.pyc in raise_for_status(self)
    849 
    850         if http_error_msg:
--> 851             raise HTTPError(http_error_msg, response=self)
    852 
    853     def close(self):

HTTPError: 400 Client Error: Bad Request
Run Code Online (Sandbox Code Playgroud)

但是,如果我在浏览器中访问该 url,它就可以工作。然后,当我回到代码并在我的浏览器(运行 iPython 的 Chrome)中手动访问 URL 后再次运行它时,代码运行没有错误。但是,它可能会返回到在顺序执行中引发错误。

这段代码已经为我工作了数百次,甚至数千次都没有问题。我该如何解决这个错误? …

python json ipython http-error python-requests

5
推荐指数
1
解决办法
1万
查看次数

如何阻止Azure IIS附加错误状态代码查询字符串

我在web.config文件中进行了以下设置来处理错误:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="500" />
  <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/" />
</httpErrors>
Run Code Online (Sandbox Code Playgroud)

当我在我的应用程序中抛出异常时,它在本地工作正常,但它重定向到azure中错误页面中的以下URL(请注意,我抛出异常的页面位于URL的末尾:

https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example的.com /错误/ internalservererror/500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/ ?internalservererror/500; HTTPS://example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/internalservererror/ 500; https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example的.com /错误/ internalservererror/500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/ ?internalservererror/500; HTTPS://example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/internalservererror/ 500; HTTPS:?//example.com/error/inter ?nalservererror/500; HTTPS://example.com/error/internalservererror/ 500; HTTPS:?//example.com/about/

如何阻止IIS在Azure中检测此行为?

iis asp.net-mvc azure http-error azure-web-sites

5
推荐指数
1
解决办法
306
查看次数

使用 spring 安全性从 oauth2.0 获取 403 禁止错误

我已经在使用 spring oauth 中实现了 oauth2.0。它在本地主机中完美运行,但是当我将它部署到服务器时,在成功获得客户端凭据授权后,我收到 403 禁止。

来自本地主机的日志:工作正常。返回刷新令牌和访问令牌。

2016-08-15 23:16:06 DEBUG AntPathRequestMatcher:151 - Checking match of request : '/oauth/token'; against '/oauth/token'
2016-08-15 23:16:06 DEBUG FilterChainProxy:324 - /oauth/token?grant_type=password&client_id=my-trusted-client&username=manju&password=123456 at position 1 of 8 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2016-08-15 23:16:06 DEBUG FilterChainProxy:324 - /oauth/token?grant_type=password&client_id=my-trusted-client&username=manju&password=123456 at position 2 of 8 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
2016-08-15 23:16:06 DEBUG FilterChainProxy:324 - /oauth/token?grant_type=password&client_id=my-trusted-client&username=manju&password=123456 at position 3 of 8 in additional filter chain; firing Filter: 'HeaderWriterFilter'
2016-08-15 23:16:06 DEBUG HstsHeaderWriter:128 - …
Run Code Online (Sandbox Code Playgroud)

java ssl spring http-error spring-security-oauth2

5
推荐指数
0
解决办法
2174
查看次数

httperrors existingResponse="Auto" 不提供自定义页面

我正在尝试在出现自定义错误时显示自定义页面。

这是我的配置:

<httpErrors existingResponse="Auto" defaultResponseMode="ExecuteURL" errorMode="Custom">
    <clear/>
    <remove statusCode="403"/>
    <error statusCode="403" responseMode="ExecuteURL" path="/403.html"/>
    <remove statusCode="404"/>
    <error statusCode="404" responseMode="ExecuteURL" path="/404.html"/>
    <remove statusCode="500"/>
    <error statusCode="500" responseMode="ExecuteURL" path="/500.html"/>
</httpErrors>
Run Code Online (Sandbox Code Playgroud)

如果我使用existingResponse="Replace".

但这也拒绝了TrySkipIisCustomErrors那是相当有需要的

我不知道如何修复它。如果我使用替换,它会破坏我的功能,如果我使用自动,那么它不会为 IIS 提供我的自定义页面

任何帮助将不胜感激

asp.net-mvc http-error

5
推荐指数
0
解决办法
309
查看次数

401客户端错误:未经授权的网址

最近我开始

requests.exceptions.HTTPError:401客户端错误:未经授权的网址:https : //api.soundcloud.com/oauth2/token

使用soundcloud(0.5.0)Python库。

它发生在

client = soundcloud.Client(client_id='id',
                           client_secret='secret',
                           username='user@mail.com',
                           password='passwd')
Run Code Online (Sandbox Code Playgroud)

我仔细检查了我的凭据以确保它们不是原因。我试图从不同的IP和不同的机器上获得一个Client实例。在一天中的某些随机时间,我可以获取一个Client实例,但是一天中有99.99%的错误。

错误是否表示我因某种原因被禁止?

python exception http-error soundcloud

5
推荐指数
1
解决办法
4700
查看次数

CondaHTTPError:dask-core-2.7.0-py_0.tar.bz2 未找到 HTTP 404

我正在尝试克隆一个环境

conda create -n myenv_legacy --clone myenv
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/conda-forge/noarch/dask-core-2.7.0-py_0.tar.bz2>
Run Code Online (Sandbox Code Playgroud)

该网址https://conda.anaconda.org/conda-forge/noarch/dask-core-2.7.0-py_0.tar.bz2不存在。但是dask-core-2.7.0-py_1.tar.bz2py_1,而不是 py_0 )存在。我该如何解决这个错误?

http-error python-3.x anaconda conda

5
推荐指数
1
解决办法
196
查看次数

Http - 隧道连接失败:Python 网页抓取出现 403 Forbidden 错误

我正在尝试网络抓取 http 网站,当我尝试阅读该网站时出现以下错误。

HTTPSConnectionPool(host='proxyvipecc.nb.xxxx.com', port=83): Max retries exceeded with url: http://campanulaceae.myspecies.info/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))
Run Code Online (Sandbox Code Playgroud)

下面是我在类似网站上编写的代码。我尝试使用 urllib 和 user-agent 但仍然存在同样的问题。

url = "http://campanulaceae.myspecies.info/"

response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'})
soup = BeautifulSoup(response.text, 'html.parser')

Run Code Online (Sandbox Code Playgroud)

谁能帮我解决这个问题。提前致谢

python http-error web-scraping

5
推荐指数
1
解决办法
4万
查看次数