【问题标题】:The remote server returned an error: (500) Internal Server Error远程服务器返回错误:(500) Internal Server Error
【发布时间】:2011-09-22 00:21:47
【问题描述】:

我是 asp.net 的新手,我的公司有一个项目,所有这个项目的开发者都从这里离开,没有人知道这个项目。我需要更新它。 实际上,所有这些都是在我的 windowsXP 系统中本地配置的。数据库、iis、项目文件都在这里。

当我使用 webrequest 时出现错误 “远程服务器返回错误:(500)内部服务器错误。” 错误和代码在这里 请帮我 错误是

Server Error in '/ava-006' Application.
The remote server returned an error: (500) Internal Server Error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.Net.WebException:远程服务器返回错误:(500) 内部服务器错误。

来源错误:

Line 50:         End If
Line 51: 
Line 52:         wResp = wr.GetResponse
Line 53:         sr = New System.IO.StreamReader(wResp.GetResponseStream)
Line 54:         Shtml = sr.ReadToEnd

源文件:F:\Prajeesh\ava-006\lead.report.aging.aspx.vb 行:52

堆栈跟踪:

[WebException: The remote server returned an error: (500) Internal Server Error.]
   System.Net.HttpWebRequest.GetResponse() +5375997
   ava_006.lead_report_aging.GetReport(String strFormat, String strWeek) in F:\Prajeesh\ava-006\lead.report.aging.aspx.vb:52
   ava_006.lead_report_aging.btnView_Click(Object sender, EventArgs e) in F:\Prajeesh\ava-006\lead.report.aging.aspx.vb:73
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +107
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3436


Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618 

我使用的代码是

<pre lang="vb">Function GetReport(ByVal strFormat As String, ByVal strWeek As String) As String
        Dim wr As WebRequest
        Dim wResp As WebResponse
        Dim sr As StreamReader
        Dim Shtml As String
        If InStr(Request.ServerVariables(&quot;path_info&quot;), &quot;ava-006&quot;) &gt; 0 Then
            wr = HttpWebRequest.Create(&quot;http://&quot; &amp; Request.ServerVariables(&quot;server_name&quot;) &amp; &quot;/ava-006/lead.report.agingsub.aspx?pFormat=&quot; &amp; strFormat &amp; &quot;&amp;pWeek=&quot; &amp; strWeek)
        Else
            wr = HttpWebRequest.Create(&quot;http://&quot; &amp; Request.ServerVariables(&quot;server_name&quot;) &amp; &quot;/lead.report.agingsub.aspx?pFormat=&quot; &amp; strFormat &amp; &quot;&amp;pWeek=&quot; &amp; strWeek)
        End If
        wResp = wr.GetResponse
        sr = New System.IO.StreamReader(wResp.GetResponseStream)
        Shtml = sr.ReadToEnd
        GetReport = Shtml
    End Function</pre>

【问题讨论】:

  • 我认为错误出在您尝试获取数据的服务器上,而不是在此代码上。因此,您需要检查您实际尝试获取数据的远程服务器是否正常工作,以及数据是否在您要求的位置。这是您需要检查其是否正常工作的内容。 server_name//ava-006/lead.report.agingsub.aspx

标签: asp.net iis


【解决方案1】:

在您的 btnView_Click 上设置一个断点并查看异常发生的位置。

【讨论】:

    【解决方案2】:

    错误在您的页面中lead.report.agingsub.aspx 当它通过 pFormatpWeek 它的抛出错误所以 其显示错误 500,因为 wr.GetResponse 从页面 lead.report.agingsub.aspx

    返回错误

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-20
      • 2020-09-11
      • 1970-01-01
      • 1970-01-01
      • 2015-08-16
      相关资源
      最近更新 更多