iis应该怎么配置?

来源:百度知道 编辑:UC知道 时间:2024/06/18 09:17:24
我写了个读取文件的源代码,代码没有错,因为我用vs内置服务器看了,很正常,但是我用iis看,就出现了这样地问题。

Exception Details: System.UnauthorizedAccessException: Access to the path 'E:\ztx\website\File\abce.txt' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Access to the path 'E:\ztx\website\File\abce.txt' is denied.
这都告诉你了,没有权限
找到E:\ztx\website\File\abce.txt,在上面按右键,属性,安全,把Everyone用户添加进来就可以了,
也可以对E:\ztx\website\File\这个目录这么操作
那这个目录下的所有文件都自动有权限了。

把aspnet用户升为管理员权限.
开始 - 控制面板 - 管理工具
进到 计算机管理
然后找 本地用户和组 - 用户 - ‘ASPNET’用户(右边)
双击 出现 aspnet属性对话框
‘隶属于’选项卡
把“Administrators”组添加进去。
此操作需要管理员权限。