您的位置:首页 > 其它

.NET中iis配置完后报错及解决方案

2007-05-31 10:54 260 查看
问题如下:
我的电脑通过域登录,系统为server 2003的,已安装好IIS和.net框架.iis中html和asp文件均可运行.但我用aspx文件测试却不行,错误如下:
编译器错误信息: CS0016: 未能写入输出文件“c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/2135a508/8d69a834/vijrpkkp.dll”--“拒绝访问。 ”
我看了很多关于IIS配置方面的文章,启用父路径,更改权限,启用匿名访问,以及开启了关于ASP.NET的服务都不行.

现在解决如下:

一.微软的解决方案如下:

http://support.microsoft.com/default.aspx?scid=kb;en-us;825791

SYMPTOMS(症状)

loadTOCNode(1, 'symptoms');
When you view a Microsoft ASP.NET Application in a Web browser, you may receive the following error messages:

For the Microsoft .NET Framework version 1.1, the error message is the following:
CS0016: Could not write to output file 'c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/application1/c11b43f6/cf3ec03/rizcntet.dll' . The directory name is invalid.
For the .NET Framework 1.0, the error message is the following:
CS0013: Unexpected error writing metadata to file 'C:/WINDOWS/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/application2/3fc72f26/eb731247/ev2bslce.dll'. The directory name is invalid.

CAUSE(原因)

loadTOCNode(1, 'cause');
The system TEMP and TMP variables point to a folder that does not exist. The compiler generates temporary files in the folder where the TEMP and the TMP variables point to before the files are copied to the Temporary ASP.NET Files folder. However, the folder where the system variables point to is deleted when you restart the computer. Therefore, the compiler cannot generate the temporary files.
微软解释是:系统环境变量TEMP,TMP指向的文件夹不存在,编译器会在文件拷贝到Temporary ASP.NET Files文件夹前,产生临时文件到TEMP,TMP指向的文件夹,当你重启系统的时候这两个系统变量已经被删除了.

RESOLUTION

loadTOCNode(1, 'resolution');

1.Create a temporary folder under %Systemroot%, and then name it Temp.
2.Grant full permissions on the Temp folder to the aspnet user account in .NET Framework 1.0 or to the NETWORK SERVICE user account in .NET Framework 1.1.
3.Right-click My Computer, and then click Properties.
4.On the Advanced tab, click Environment Variables.
5.Select the TEMP variable under System variables, and then click Edit.
6.Type %SystemRoot%/TEMP in the Variable Value box, and then click OK.
7.Repeat steps 5 and 6 to edit the TMP variable. Click OK two times.
8.Click Start, and then click Run.
9.To reset Internet Information Services (IIS), type iisreset on the command prompt.

Note If the error message that is mentioned in the "Symptoms" section of this article persists, restart the computer.
解决:1.在C:windows文件夹创建TEMP文件夹(如有就不用建了) 2.如果 .NET Framework 1.0的则对TEMP文件夹增加ASPNET用户,给予足够的权限, 如果 .NET Framework 1.1的则对TEMP文件夹增加NETWOR SERVICE用户,给予足够的权限. 3.在系统环境变量里面创建两个变量:TEMP,TMP都指向TEMP文件夹.

这是微软的解决方案.网上有的方法是对Temporary ASP.NET Files文件夹增加用户以及赋权限.实际上Temporary ASP.NET Files为临时文件夹是可以继承TEMP文件夹的权限的,所以设了TEMP文件夹就可以了.

windows / temp权限

先确认windows目录下temp文件夹是否拥有以下帐号.



然后确认network service的帐号权限



确认users的权限是否正确



经过这些设置后,您的.net程序在运行时基本不会有什么问题了.
以上权限配置TEMP目录的NETWORK SERVICE用户权限如果设为特殊的还不行,设为完全控制的权限就没问题了.

现在一般的ASP.net都升级了2.0的版本!那么可能会出现以下错误:

配置错误
说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。
分析器错误信息: 无法识别的属性“xmlns”。

源错误:

行 1: <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
行 2: <appSettings/>
行 3: <connectionStrings>
后来研究发现,是框架解析的问题,因为我开发用的是vs2005这个是在framework 2.0 下编译运行的,而公司虽然也装上了framework2.0,但是由于,是iis没有注册asp.net2.0 而仍然是1。1的。

解决办法:
在DOS下 C:/WINDOWS/Microsoft.NET/Framework/v2.0.50215目录中运行
aspnet_regiis.exe -i

也可以在iis中的属性设置,参照下面图



注意改成2.0之后又可能会出现权限不够的错误,将V2.0的Temporary ASP.NET Files文件夹增加NETWORK SERVICE用户并赋以足够权限就可以了.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: