日期:2014-05-17  浏览次数:21364 次

Access is denied
Access is denied. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: Access 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 write 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.

Source Error: 


Line 76:  DateTime sTimes,eTimes;
Line 77:  sTimes = DateTime.Now;
Line 78:  Excel.ApplicationClass oExcel = new ApplicationClass();
Line 79:  eTimes = DateTime.Now;
Line 80: 
 


这个Excel怎么弄都总数拒绝访问,我已经在web.fig文件加了
    <identity impersonate="true" userName="np1-it-10602\it-pds" password="pds123" />


又在machine.config里改了:
		<processModel enable="true" timeout="Infinite" idleTimeout="Infinite" shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60" webGarden="false" cpuMask="0xffffffff" userName="np1-it-10602\it-pds" password="pds123" logLevel="Errors" clientConnectedCheck="0:00:05" comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate" responseDeadlockInterval="00:03:00" maxWorkerThreads="20" maxIoThreads="20"/>


    <identity impersonate="true" userName="np1-it-10602\it-pds" password="pds123" />


又把权限给了full control了,为什么还是访问拒绝~!!一周了,还是解决不了,求搭救~
asp.net C#

------解决方案--------------------
你把你的excel文件扔到webapplication的目录下就可以的了。
用户权限问题。你看看你的文件夹的用户列表和iis下的文件夹的用户列表不一样的
------解决方案--------------------
Access is denied
权限配置一下。
修改文件夹权限:文件夹权限配置组图