简体   繁体   English

无法使用IIS 6.0在经典ASP中写入文件

[英]Unable to write a file in classic asp using IIS 6.0

I am using Windows 2003 and have an IIS website. 我正在使用Windows 2003,并且有一个IIS网站。

I created a file called test.asp in the c:\\inetpub\\wwwroot directory with the following contents: 我在c:\\inetpub\\wwwroot目录中创建了一个名为test.asp的文件,其内容如下:

<html>
  <body>
    <p>This is the text in the text file:</p>
    <%
    Set fs = Server.CreateObject("Scripting.FileSystemObject")
    set f = fs.CreateTextFile(Server.MapPath("testread.txt"), true)
    Response.Write("This Worked!")
    f.Close

    Set f = Nothing
    Set fs = Nothing
    %>
  </body>
</html>

When I view the page, I get the generic "Page cannot be displayed" which makes me think that there is an error in my script. 当我查看页面时,我得到通用的“页面无法显示”,这使我认为脚本中有错误。 I have tracked it down to the CreateTextFile function, it somehow fails. 我已经将其跟踪到CreateTextFile函数,但是它以某种方式失败了。

My First question: 我的第一个问题:

Is there anyway to debug this? 有没有调试这个? I don't know how to view errors with this page, I always just get the "Page cannot be displayed" . 我不知道如何查看此页面的错误,我总是得到“页面无法显示”的信息

Second question: 第二个问题:

I don't know if there might be some sort of permissions issue? 我不知道是否可能存在某种权限问题? I tried setting the permissions of the Scripting.FileSystemObject key in registry to full control for EVERYONE . 我尝试将注册表中Scripting.FileSystemObject项的权限设置为对EVERYONE完全控制。

I don't know what else could be preventing me from writing a file? 我不知道还有什么可能会阻止我写文件? I have verified that I can read a file with no problems. 我已经验证我可以毫无问题地读取文件。

If you're using Internet Explorer make sure you have the following setting unchecked : 如果您使用的是Internet Explorer,请确保未选中以下设置:

Tools -> Options -> Advance Tab -> Show Friendly HTTP error messages

The next thing to check is that the anonymous account for the site has write access to the c:\\inetpub\\wwwroot folder. 接下来要检查的是该站点的匿名帐户具有对c:\\inetpub\\wwwroot文件夹的写访问权。

In IIS6, to find the site's anonymous account: 在IIS6中,找到站点的匿名帐户:

Open IIS MMC by clicking - 通过单击打开IIS MMC-

Start -> Settings -> Control Panel -> Administrative Tools  
                           -> Internet Information Services (IIS) Manager

Browse and select the Default Web Site then right click and select Properties . 浏览并选择Default Web Site然后右键单击并选择Properties On the tabbed dialogue select the Directory Security tab. 在选项卡式对话框中,选择目录安全性选项卡。

Click the Edit button in the Authentication and access control panel. 单击“ 身份验证和访问控制”面板中的“ Edit按钮。 Note the value in the User name field (whatever you do don't alter this). 请注意“ User name字段中的值(无论如何,请不要更改此值)。 Click the Cancel button twice to dismiss these dialogues. 单击Cancel按钮两次以关闭这些对话框。

In explorer right click and open the properties of c:\\inetpub\\wwwroot . 在资源管理器中,右键单击并打开c:\\inetpub\\wwwroot的属性。 Select the Security tab and make sure that the anonymous account noted above is added and has at the very least Modify permissions. 选择“ 安全性”选项卡,并确保添加了上面提到的匿名帐户,并且至少具有“ Modify权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM