iis应该怎么配置?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iis应该怎么配置?相关的知识,希望对你有一定的参考价值。
我写了个读取文件的源代码,代码没有错,因为我用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.
代码如下:
FileStream aFile = null;
aFile = new FileStream(@"E:\ztx\website\File\abce.txt",FileMode.Open);
Response.Write("Ol");
这都告诉你了,没有权限
找到E:\ztx\website\File\abce.txt,在上面按右键,属性,安全,把Everyone用户添加进来就可以了,
也可以对E:\ztx\website\File\这个目录这么操作
那这个目录下的所有文件都自动有权限了。 参考技术A 把aspnet用户升为管理员权限.
开始 - 控制面板 - 管理工具
进到 计算机管理
然后找 本地用户和组 - 用户 - ‘ASPNET’用户(右边)
双击 出现 aspnet属性对话框
‘隶属于’选项卡
把“Administrators”组添加进去。
此操作需要管理员权限。
IIS的配置问题
Server Error in '/' Application.
--------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, '<compilation targetFramework="4.0">'). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.
Source Error:
Line 75: </appSettings>
Line 76: <system.web>
Line 77: <compilation targetFramework="4.5">
Line 78: <assemblies>
Line 79: <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Source File: D:\DefaultWeb\web.config Line: 77
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
谁知道这是怎么回事啊 求解决
2、当前网站的IIS参数里要选择.NET Framework4.0 参考技术D 更新.NET Framework为最新版本或4.0以上版本。 第5个回答 2015-01-14 你的web.config targetFramework 配置太低呢 请配置成4.0
以上是关于iis应该怎么配置?的主要内容,如果未能解决你的问题,请参考以下文章