我们最近将一个ASP应用程序从IIS 6.0 Web实例上运行到一个单独的IIS 7.5实例 . 当我们调用其中一个执行PDF文件操作的函数然后通过电子邮件发送文件时,我们会收到以下错误,我们不确定如何解决:
Server Error in '/' Application.
Access is denied.
Description: 执行当前Web请求期间发生了未处理的异常 . 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息 .
Exception Details: System.UnauthorizedAccessException:访问被拒绝 .
ASP.NET无权访问所请求的资源 . 考虑将资源的访问权限授予ASP.NET请求标识 . ASP.NET具有基本进程标识(通常是IIS 5上的 \ ASPNET或IIS 6上的网络服务),如果应用程序未模拟,则使用该标识 . 如果应用程序模拟通过,则标识将是匿名用户(通常为IUSR_MACHINENAME)或经过身份验证的请求用户 .
要授予对文件的ASP.NET访问权限,请在资源管理器中右键单击该文件,选择“属性”,然后选择“安全”选项卡 . 单击“添加”以添加适当的用户或组 . 突出显示ASP.NET帐户,并选中所需访问的框 .
Source Error:
[No relevant source lines]
Source File: c:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \ root \ 284fd53e \ 989a1e10 \ App_Web_2wpmcxaa.3.cs Line:0
Stack Trace:
[UnauthorizedAccessException: Access is denied.
]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +337
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) +36
System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) +66
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +49
[HttpException (0x80004005): Access is denied.
]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +99
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1738
System.Web.Mail.SmtpMail.Send(MailMessage message) +273
Nps.PayrollPlus.NpsPage.Page_Error(Object sender, EventArgs e) +660
System.Web.UI.TemplateControl.OnError(EventArgs e) +8781802
System.Web.UI.Page.HandleError(Exception e) +84
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6776
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.rms009_reportdist_rddist_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\284fd53e\989a1e10\App_Web_2wpmcxaa.3.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously
2 回答
在IIS服务器配置中的权限菜单(通常位于右侧)下,添加所有人或匿名身份验证,您的错误就可以了 .
尝试启用站点文件夹的匿名身份验证 . 我也有同样的问题,它对我有用 .