C# ASP.NET,服务器返回的状态码为:500
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2351504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ASP.NET, The status code returned from the server was: 500
提问by LeeW
A customer using a ASP.NET program I have just sent them is experiencing the error below, I had personally tested the program on 4 web server IIS6, 7, and 7.5, on 4 different networks and I never got this, the customer is using IIS6 with .Net 2.0 (as required). The program uses Windows authentication which may or may not be part of the problem. I'm stuck I don't know where to start with this. Any help is very much appreciated.
使用我刚刚发送给他们的 ASP.NET 程序的客户遇到以下错误,我在 4 个不同的网络上的 4 个 Web 服务器 IIS6、7 和 7.5 上亲自测试了该程序,但我从未得到过这个,客户正在使用带有 .Net 2.0 的 IIS6(根据需要)。该程序使用 Windows 身份验证,这可能是问题的一部分,也可能不是问题的一部分。我被困住了,我不知道从哪里开始。很感谢任何形式的帮助。
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Sys.WebForms.PageRequestManagerServerErrorException: 在服务器上处理请求时发生未知错误。服务器返回的状态码为:500
采纳答案by John Saunders
HTTP error code 500 simply means "something bad happened on the server, but we're not going to tell you what that was".
HTTP 错误代码 500 仅表示“服务器上发生了一些不好的事情,但我们不会告诉您那是什么”。
You have to "ask" the server machine what went wrong. Look into the Windows event logs, the IIS logs, or your application's own logs to find out what the "something" is.
您必须“询问”服务器机器出了什么问题。查看 Windows 事件日志、IIS 日志或您的应用程序自己的日志,以找出“某些东西”是什么。
回答by AxelEckenberger
This error often means that there is some exception thrown inside your code, e.g. because a reference is null or something else.
此错误通常意味着在您的代码中抛出了一些异常,例如因为引用为空或其他原因。
回答by bhanu
If you have < > /
characters in your web form you will get this error.
Try placing ValidateRequest="false"
in the page directive of your page.
如果您< > /
的网络表单中有字符,您将收到此错误。
尝试放置ValidateRequest="false"
在页面的页面指令中。
回答by Mehdi
If you have < > / characters in your web form you will get this error. You must insert space or single quotation mark, right and left for example :
如果您的网络表单中有 < > / 字符,您将收到此错误。您必须在左右插入空格或单引号,例如:
false: 1<TR<5
True:1< TR <5 or 1<'TR'<5