我的网页上有文件上传控件.最大请求长度设置为8 MB(maxRequestLength = 8192).我还有服务器验证,如果文件超过4MB则抛出错误.它在配置中的8MB是为用户提供的杠杆,也是为了测试应用程序的原因.
如果我上传了一个9MB的文件,我会抛出异常超出最大请求长度.,这很好,按预期工作.但是当我尝试上传一个1GB的文件时,它会显示一个HTTP 404 - 找不到文件.有人可以解释为什么会这样,我怎么能让它给我一个maxRequestLength异常?
我正在使用IIS6.
使用Intergrated .net 4.0应用程序池创建了一个新的IIS7网站.
以.aspx结尾的网址会显示自定义404其他任何内容都会显示蓝色服务器错误页面"HTTP错误404.0 - 未找到您要查找的资源已被删除,名称已更改或暂时不可用." (所以与IE无关)
<customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="/pages/404.aspx" />
</system.web>
<system.webServer>
<httpErrors >
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/pages/404.aspx" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
也试过了
<httpErrors existingResponse="PassThrough" />
Run Code Online (Sandbox Code Playgroud)
但这只是导致空洞的回应.
我只找到了一个对执行appcmd来测试自定义http错误处理的有用性的引用,但这里是结果.
C:\Windows\System32\inetsrv>appcmd list config "http://mysite/file.notexist" -section:httpErrors
<system.webServer>
<httpErrors>
<error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="401.htm" />
<error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="403.htm" />
<error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="404.htm" />
<error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="405.htm" />
<error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="406.htm" />
<error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
r" path="412.htm" />
<error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custer …Run Code Online (Sandbox Code Playgroud) 我有一个react组件,它是列表中的详细信息视图.
如果图像不存在并且存在404错误,我试图用默认图像替换图像.
我通常会在img标签中使用onerror方法,但这似乎不起作用.
我不知道如何做出反应.
这是我的组件:
import React from 'react';
import {Link} from 'react-router';
import ContactStore from '../stores/ContactStore'
import ContactActions from '../actions/ContactActions';
class Contact extends React.Component {
constructor(props) {
super(props);
this.state = ContactStore.getState();
this.onChange = this.onChange.bind(this);
}
componentDidMount() {
ContactStore.listen(this.onChange);
ContactActions.getContact(this.props.params.id);
}
componentWillUnmount() {
ContactStore.unlisten(this.onChange);
}
componentDidUpdate(prevProps) {
if (prevProps.params.id !== this.props.params.id) {
ContactActions.getContact(this.props.params.id);
}
}
onChange(state) {
this.setState(state);
}
render() {
return (
<div className='container'>
<div className='list-group'>
<div className='list-group-item animated fadeIn'>
<h4>{this.state.contact.displayname}</h4>
<img src={this.state.imageUrl} />
</div>
</div>
</div>
);
} …Run Code Online (Sandbox Code Playgroud) 我是Solr的新手,在ubuntu 8.10中安装后,当我尝试使用exampledocs进行索引时,根据此链接,我收到此错误:
HTTP错误:404缺少路径中的核心名称
这是在码头.
我该怎么做才能解决这个问题?
我在GAE上使用其他地方找到的提示设置了静态网站,但无法弄清楚如何返回404错误.我的app.yaml文件看起来像
- url: (.*)/
static_files: static\1/index.html
upload: static/index.html
- url: /
static_dir: static
Run Code Online (Sandbox Code Playgroud)
将所有静态html/jpg文件存储在静态目录下.以上适用于存在的文件,但如果不存在,则返回空长文件.答案可能是编写一个python脚本来返回404错误,但是如何设置为现有的静态文件提供服务但是为不存在的文件运行脚本呢?
以下是在开发应用程序服务器上获取不存在的文件(nosuch.html)的日志:
ERROR 2008-11-25 20:08:34,084 dev_appserver.py] Error encountered reading file "/usr/home/ctuffli/www/tufflinet/static/nosuch.html":
[Errno 2] No such file or directory: '/usr/home/ctuffli/www/tufflinet/static/nosuch.html'
INFO 2008-11-25 20:08:34,088 dev_appserver.py] "GET /nosuch.html HTTP/1.1" 404 -
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用HttpWebRequest来验证Url的存在.我找到了几个基本上做的例子:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
request.Method = "HEAD";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
return response.StatusCode;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果url确实被破坏了,它不会返回响应,而是抛出异常.
我修改了我的代码:
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
request.Method = "HEAD";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
return response.StatusCode;
}
}
catch (System.Net.WebException ex)
{
var response = ex.Response as HttpWebResponse;
return response == null ? HttpStatusCode.InternalServerError : response.StatusCode;
}
Run Code Online (Sandbox Code Playgroud)
这似乎终于做了我想要的.
但我想知道,为什么请求抛出异常而不是使用NotFound状态代码返回响应?
我正在尝试重定向到使用router.beforeEach全局挂钩未找到的页面上的404.html ,但没有太大成功(使用Vue和Vue-Router1.0):
router.beforeEach(function (transition) {
if (transition.to.path === '/*') {
window.location.href = '/404.html'
} else {
transition.next()
}
});
Run Code Online (Sandbox Code Playgroud)
404.html插入不存在的路径时,这不会重定向到页面,只是给我一个空片段.只有在硬编码some-site.com/*时,它才会重定向到预期的some-site.com/404.html
我确信这里有一些非常明显的东西,我忽略了,但我无法弄清楚是什么.
请注意,我正在寻找的是重定向到新页面,而不是重定向到另一个路由,这可以通过使用router.redirect这些片段轻松实现:
router.redirect({
'*': '404'
})
Run Code Online (Sandbox Code Playgroud)
在我身上router.map,我可以拥有以下内容:
router.map({
'/404': {
name: '404'
component: {
template: '<p>Page Not Found</p>'
}
}
})
Run Code Online (Sandbox Code Playgroud) 我正在尝试为自定义模块实现一些配置设置.我设法在左侧导航栏中添加了一个标签和一个部分.但是当我想打开一个部分时,我得到一个404错误页面而没有任何进一步的信息.
到目前为止,我已经尝试了任何工作来阅读博客,示例等,但我找不到错误.也许你们中的某个人可以向我解释我做错了什么.
我的adminhtml.xml:
<?xml version="1.0" ?>
<config>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<tempest_section translate="title" module="Tempest">
<title>Tempest</title>
</tempest_section>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</config>
Run Code Online (Sandbox Code Playgroud)
我的config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Polyvision_Tempest>
<version>0.1.0</version>
</Polyvision_Tempest>
</modules>
<global>
<helpers>
<Tempest>
<class>Polyvision_Tempest_Helper</class>
</Tempest>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<tempest before="Mage_Adminhtml">Polyvision_Tempest_Adminhtml</tempest>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<menu>
<menu1 translate="title" module="Tempest">
<title>polyvision</title>
<sort_order>60</sort_order>
<children>
<menuitem1 module="Tempest">
<title>Tempest - Export</title>
<action>adminhtml/tempest_main</action>
</menuitem1>
</children>
</menu1>
</menu>
</adminhtml>
<default>
<tempest> …Run Code Online (Sandbox Code Playgroud) 我已经按照起始指南进行了扩展,并扩展了之前的角度2版本.我已经更新了我的修订版并相应更改了所有内容.当我运行Web服务器时,我现在收到错误404 for traceur ...

相关文件:
index.html的:
<html>
<head>
<title>Kinepolis HR-tool</title>
<base href="./">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Kinepolis HR tool">
<meta name="author" content="Jeffrey Devloo!">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
<!-- CSS for PrimeUI -->
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body> …Run Code Online (Sandbox Code Playgroud) 我正在尝试确定在标准ASP.NET Web应用程序中实现404页面的最佳方法.我目前在Global.asax文件中的Application_Error事件中捕获404错误,并重定向到友好的404.aspx页面.问题是请求看到302重定向,然后缺少404页面.有没有办法绕过重定向并使用包含友好错误消息的立即404进行响应?
Googlebot等网络抓取工具是否关心非现有页面的请求是否返回302后跟404?