访问路径' C:\ inetpub \ wwwroot \ folder \ file.pdf被拒绝

时间:2018-03-23 13:50:56

标签: amazon-web-services permissions file-permissions

我一直在处理有关将ELB部署到带有负载均衡器的新测试环境的问题。 我以前通过测试运行代码,并通过RDP连接到实例,我能够将我用iTextSharp创建的PDF文件保存在我用我的代码创建的文件夹下。

但是,一旦我创建了多实例环境并希望继续进行ELB部署,我就遇到了访问问题。

PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(fileName, fileMode.OpenOrCreate));

在这里,我使用Server.MapPath生成fileName变量并尝试在同一路径上获取FileStream。我到达的示例路径是标题中提到的路径:C:\inetpub\wwwroot\folder\file.pdf

为了确保这一点,我在我的项目下创建了一个folder文件夹,在(Text.txt)下放置了一个txt文件,通过ELB发布了此版本,我能够访问该文件在我的网站的/folder/Text.txt

域中

我已在AWS控制台中检出安全组和角色管理部分,但我找不到任何类似I / O权限的内容。这个问题有可能解决方法吗?我在互联网上搜索,但我看到的唯一的事情涉及通过IIS工作,这对我没用,因为在这种情况下我不会通过RDP连接到实例。

编辑:我收到的异常电子邮件信息。

Exception Details:
Message :   Access to the path 
C:\inetpub\wwwroot\agreements\TM_1efced9a40fc46d2b2da2ebd97847de1.pdf' is 
denied. 

Source :    mscorlib 
Stacktrace :    at System.IO.__Error.WinIOError(Int32 errorCode, String 
maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, 
FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String 
msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at 
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, 
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, 
Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode 
mode) at Cepstop.Web.Controllers.CommonController.ExportHtmlToPDF(String 
fileName, FibaModel fModel, String type) in 
C:\Projects\Cepstop\Cepstop.Web\Controllers\CommonController.cs:line 926 
Related Function Details:

Related Function Name :     WinIOError 

Parameters:
System.Int32 :      errorCode 
System.String :     maybeFullPath 

0 个答案:

没有答案