Tom*_*len 6 asp.net iis-7 xmlhttprequest asp-classic
我在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
Run Code Online (Sandbox Code Playgroud)
这是向ASP.net ASHX处理程序发送请求.运行时,它会在最终发送错误消息之前挂起很长时间:
msxml3.dll错误'800c0008'
指定资源的下载失败.
/forum/new_post.asp,第1036行
我已经检查了它发布到的URL,它存在且正在运行.发送的数据也是正确的.
在我全新安装Windows 7之前,它运行良好.由于重新安装它,并再次设置IIS这段代码失败,让我相信它是一个权限/身份错误.
有谁能告诉我是什么原因造成的?我有3个应用程序池:
ASP.net v4.0 (Integrated) (ApplicationPoolIdentity)
ASP.net v4.0 Classic (Classic) (ApplicationPoolIdentity)
DefaultAppPool (Integrated) (NetworkService)
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
编辑:我在日志中发现了这个错误:
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:
Run Code Online (Sandbox Code Playgroud)
第13行是第一个request.form:
int TopicID = int.Parse(context.Request.Form["topicID"]);
Run Code Online (Sandbox Code Playgroud)
第一步是停止使用Microsoft.XMLHTTP,您不应该在服务基础场景中使用它。而是使用MSXML2.ServerXMLHTTP.3.0专为在服务中使用而设计的。
此外,如果被发布的 .ashx 反过来调用原始 ASP 应用程序,那么Gaby可能会发生线程饥饿问题。通常,您可以在使用较少的站点上摆脱这种情况。但是,如果您在应用程序上启用了 ASP 调试,那么回调到 ASP 应用程序肯定会挂起。请注意,这不适用于简单的 ASP 到 ASHX 方案。
如果您的问题仍然存在(可能会),则:-
>netsh>winhttp set proxy 127.0.0.1:8888>winhttp reset proxy现在检查 fiddler 中 POST 的请求/响应,这可能会揭示一些关于真正问题所在的线索。
如果我理解正确的话,您正在向与调用者相同的服务器发出请求。
阅读http://support.microsoft.com/kb/316451
不建议使用ServerXMLHTTP或WinHTTP对象向同一 Internet Information Server (IIS) 服务器发出递归超文本传输协议 (HTTP) 请求。更具体地说,调用 Active Server Page (ASP) 不应将请求发送到同一虚拟目录中的 ASP 或同一池或进程中的另一个虚拟目录。这可能会因线程匮乏而导致性能不佳。
| 归档时间: |
|
| 查看次数: |
14909 次 |
| 最近记录: |