当从Win2003移到Win2008 IIS7时,传统的ASP方法不工作?
我刚将一个老式的经典ASP站点从win2003 IIS6框移到了Win2008R2 IIS7框中,除了一件事情之外,它们都运行良好。当从Win2003移到Win2008 IIS7时,传统的ASP方法不工作?
我有一个小方法,这将让用户下载订单的CSV,方法如下:
sub DownloadOrders()
Response.clear
'Send headers for file name and content type changes
Response.AddHeader "Content-Disposition", "attachment; filename=orders.csv"
Response.ContentType = "application/text"
for I = 0 to ubound(theorderslist,2)
if I = 0 then
Response.Write("Order No,Date,Name,Address,Town/City,Country,Sub Total,Tax,Shipping,Total,Status" & vbCrLf)
end if
Response.Write("" & pOrderPrefix & "-" & theorderslist(0,I) & "," & theorderslist(3,I) & "," & theorderslist(5,I) & " " & theorderslist(7,I) & "," & Replace(theorderslist(8,I),","," ") & "," & Replace(theorderslist(12,I),","," ") & "," & theorderslist(13,I) & "," & theorderslist(14,I) & "," & theorderslist(15,I) & "," & theorderslist(16,I) & "," & theorderslist(4,I) & "," & orderStatusDesc(theorderslist(10,I)) & vbCrLf)
next
Response.End
end sub
现在,如果我点击链接我得到的是一个404错误?我甚至给了目录完整的修改权限,但仍然没有运气?任何想法我可以尝试什么?
如上所述,这已在Win2003的盒子完美工作了多年:(
@ leen3o:这听起来像application/text
MIME类型尚未在IIS中定义。本指南中包含如何手动添加它:http://www.iis.net/ConfigReference/system.webServer/staticContent/mimeMap
更新
保存行为不当的服务器,并直接访问它在你的Sub
到testcsv.asp
以下剥离下来的副本。如果生成的CSV文件没有错误,那么IIS7不喜欢的东西必须位于代码中的其他位置,您需要再粘贴一点,以便我们帮助您进行调试。
Response.AddHeader "Content-Disposition", "attachment; filename=orders.csv"
Response.ContentType = "application/text"
Response.Write("Order No,Date,Name,Address,Town/City,Country,Sub Total,Tax,Shipping,Total,Status" & vbCrLf)
Response.End
我认为这是它,但我加入了这种MIME类型,并尝试其他人包括更改文件扩展名正在返回,但仍然得到相同的错误! :( – leen3o 2010-11-29 16:18:23
@ leen3o:请看我上面更新的答案。:-) – stealthyninja 2010-11-30 22:32:34
这里有一些有用的文章
http://www.alexthissen.nl/blogs/main/archive/2008/02/18/running-classic-asp-on-iis-7.aspx
http://technet.microsoft.com/en-us/library/cc753918%28WS.10%29.aspx
感谢但我已经完成的第一个链接中的所有内容?这就是为什么我有点困惑... – leen3o 2010-11-29 15:45:58
生成CSV文件的脚本的文件类型扩展名是什么?
IIS,就不会提供它不具有MIME类型注册,而是会返回一个404个
此外作为stealthyninja状态如果application/text
MIME类型没有被映射那么IIS也不会提供服务的文件的文件类型
刚刚在我的Windows Server 2008开发机器上的IIS7实例上进行了检查,并且它没有默认注册的应用程序/文本,据我所见。
我正要问一个类似的问题,但是@stealthyninja用他精简的测试代码使我走上了正确的轨道。
对我来说,在我的文件中的罪魁祸首竟然是这样的:
Response.AddHeader "Content-Length", objFile.Size
一旦我评论说,线路输出端口,一切运行良好,这使我this SO question about content-length这有助于追查我的真正的问题。
Chrome给我这个错误信息: 无法找到文件或目录。 – leen3o 2010-11-29 15:43:25