gpt4 book ai didi

asp.net - XMLHTTPrequest 的经典 ASP 错误

转载 作者:行者123 更新时间:2023-12-02 15:06:26 24 4
gpt4 key购买 nike

我在 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 error '800c0008'

The download of the specified resource has failed.

/forum/new_post.asp, line 1036

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

在我全新安装 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"]);

最佳答案

第一步是停止使用 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重置代理恢复winhttp代理设置

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

关于asp.net - XMLHTTPrequest 的经典 ASP 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7947732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com