【发布时间】:2017-01-27 18:55:28
【问题描述】:
我们最近将一个在 IIS 6.0 Web 实例上运行的 ASP 应用程序转移到了一个单独的 IIS 7.5 实例。当我们调用执行 PDF 文件操作的函数之一,然后通过电子邮件发送文件时,我们收到以下错误,我们不确定如何解决:
“/”应用程序中的服务器错误。
访问被拒绝。
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详情: System.UnauthorizedAccessException:访问被拒绝。
ASP.NET 无权访问请求的资源。考虑向 ASP.NET 请求标识授予对资源的访问权限。 ASP.NET 有一个基本进程标识(通常是 IIS 5 上的 {MACHINE}\ASPNET 或 IIS 6 上的网络服务),如果应用程序不模拟,则使用该标识。如果应用程序通过 模拟,则身份将是匿名用户(通常是 IUSR_MACHINENAME)或经过身份验证的请求用户。
要授予 ASP.NET 对文件的访问权限,请在资源管理器中右键单击该文件,选择“属性”并选择“安全”选项卡。单击“添加”以添加相应的用户或组。突出显示 ASP.NET 帐户,然后选中所需访问权限的复选框。
来源错误:
[No relevant source lines]
源文件: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\284fd53e\989a1e10\App_Web_2wpmcxaa.3.cs 行:0
堆栈跟踪:
[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
【问题讨论】: