XMLHTTPrequest的经典ASP错误

时间:2011-10-30 20:50:19

标签: asp.net iis-7 asp-classic xmlhttprequest

我在IIS 7.5上运行经典ASP和ASP.net 4.0。

在我的经典ASP代码中是这段代码:

' Process @ alerts
Dim objHttp
set objHttp = Server.CreateObject("Microsoft.XMLHTTP")

objHttp.open "POST", strSiteRoot & "handlers/forumalerts.ashx?", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send "topicID=" & lngTopicID & "&threadID=" & lngLastPostID

set objHttp = nothing

这是向ASP.net ASHX处理程序发送请求。运行时,它会在最终发送错误消息之前挂起很长时间:

  

msxml3.dll错误'800c0008'

     

指定资源的下载失败。

     

/forum/new_post.asp,第1036行

我已经检查了它发布到的网址,它存在且正在运行。发送的数据也是正确的。

在我全新安装Windows 7之前,它运行正常。自从重新安装它以及再次设置IIS后,这段代码就失败了,这让我感到相信它是一个权限/身份错误。

谁能告诉我是什么原因导致的?我有3个应用程序池:

ASP.net v4.0 (Integrated) (ApplicationPoolIdentity)
ASP.net v4.0 Classic (Classic) (ApplicationPoolIdentity)
DefaultAppPool (Integrated) (NetworkService)

感谢您的帮助!

编辑:我在日志中发现了这个错误:

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 02/11/2011 14:55:42 
Event time (UTC): 02/11/2011 14:55:42 
Event ID: 4e550d910b934d2781707701f833e18e 
Event sequence: 39 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT-2-129647191892089824 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\ScirraNew\ 
    Machine name: TOM-PC 

Process information: 
    Process ID: 7980 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\NETWORK SERVICE 

Exception information: 
    Exception type: ArgumentNullException 
    Exception message: Value cannot be null.
Parameter name: String
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Int32.Parse(String s)
   at forumalerts.ProcessRequest(HttpContext context) in c:\inetpub\wwwroot\ScirraNew\Handlers\forumalerts.ashx:line 13
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



Request information: 
    Request URL: http://127.0.0.1/handlers/forumalerts.ashx 
    Request path: /handlers/forumalerts.ashx 
    User host address: 127.0.0.1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: NT AUTHORITY\NETWORK SERVICE 

Thread information: 
    Thread ID: 39 
    Thread account name: NT AUTHORITY\NETWORK SERVICE 
    Is impersonating: True 
    Stack trace:    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Int32.Parse(String s)
   at forumalerts.ProcessRequest(HttpContext context) in c:\inetpub\wwwroot\ScirraNew\Handlers\forumalerts.ashx:line 13
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details: 

第13行是第一个request.form:

int TopicID = int.Parse(context.Request.Form["topicID"]);

4 个答案:

答案 0 :(得分:4)

如果我理解正确,您正在向与呼叫服务器相同的服务器发出请求..

阅读http://support.microsoft.com/kb/316451

  

使用 ServerXMLHTTP WinHTTP 对象制作递归超文本   传输协议(HTTP)请求到相同的Internet信息   建议不要使用服务器(IIS)服务器。更具体地说,是呼唤   Active Server Page(ASP)不应该向ASP发送请求   相同的虚拟目录或另一个虚拟目录   游泳池或过程。这可能导致由于线程导致的性能不佳   饥饿。

答案 1 :(得分:4)

第一步是停止使用Microsoft.XMLHTTP,您不应该在服务基础场景中使用它。而是使用专为服务设计的MSXML2.ServerXMLHTTP.3.0

此外,如果正在发布的.ashx回调到原始ASP应用程序,那么Gaby可能发生的线程饥饿问题可能正在发生。通常,您可以在使用率较低的网站上使用此功能。但是,如果您在应用程序上启用了ASP调试,那么回调到ASP应用程序肯定会挂起。请注意,这不适用于简单的ASP到ASHX场景。

如果您的问题仍然存在(可能会出现问题),那么: -

  • 在您的计算机上安装fiddler的副本。
  • 消防Fiddler
  • 在命令提示符中输入>netsh
  • 发出命令>winhttp set proxy 127.0.0.1:8888
  • 尝试使用您的ASP页面,您应该看到fiddler
  • 捕获的POST
  • 使用>winhttp reset proxy
  • 恢复winhttp代理设置

现在检查fiddler中POST的请求/响应,这可能会揭示真正问题所在的一些线索。

答案 2 :(得分:0)

我是ASP经典新手。

但是请求的页面可能会向第一页发送响应并等待接收,第一页不会收到响应,因此会发生错误。

尝试在objHttp.Send之后使用以下内容:

objHttp.ResponseText

噢,刚才发现这一行可能出现的错误:

  

objHttp.open "POST", strSiteRoot & "handlers/forumalerts.ashx?", false

尝试使用字符串" handlers/forumalerts.ashx?"没有"?"最后。

答案 3 :(得分:0)

我已Server.CreateObject("MSXML2.XMLHTTP")

替换Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")

然后错误再也没有出现过了。

相关问题