I am using IIS V6.0 on a Windows box.
I have created a folder called “AsposeLic” for licence file under wwwroot. i.e I have c:\inetpub\wwwroot\AsposeLic.
Within this folder, I have placed Aspose.Words.Lic file.
I tried to set the licence using setLicence command and got the error that Access is Denied to c:\inetpub\wwwroot\AsposeLic.
Can you please provide me with what permissions I need to setup on the folder and the file.
Regards
Mayur
Hi
Thanks for your request. I think, in your case, you should simply put the license into your application’s folder and access it using Server.MapPath.
Best regards,
Hi
This is the code I already have
void Application_Start(object sender, EventArgs e)
{
String mapPath = Server.MapPath("~");
String filePath = System.IO.Directory.GetParent(System.IO.Directory.GetParent(mapPath).FullName).FullName;
String wordLicPath = filePath + "\\AsposeLic\\Aspose.Words.lic";
String pdfLicPath = filePath + "\\AsposeLic\\Aspose.Pdf.lic";
// Code that runs on application startupmayur123
Aspose.Words.License AsposeWordlic = new Aspose.Words.License();
AsposeWordlic.SetLicense(wordLicPath);
Aspose.Pdf.License PDFlicense = new Aspose.Pdf.License();
System.IO.FileStream pdfFileStream = new System.IO.FileStream(pdfLicPath, System.IO.FileMode.Open);
PDFlicense.SetLicense(pdfFileStream);
I get the following error
================================================== 9:28:30 AM 11/17/2011 : File Path isC:\Inetpub\wwwroot
9:28:30 AM 11/17/2011 : WordLicPath isC:\Inetpub\wwwroot\AsposeLic\Aspose.Words.lic
9:28:30 AM 11/17/2011 : PdfLicPath isC:\Inetpub\wwwroot\AsposeLic\Aspose.Pdf.lic
9:28:30 AM 11/17/2011 : An error occured: on 11/17/2011 9:28 AM
Exception Message: Access to the path 'C:\Inetpub\wwwroot\AsposeLic\Aspose.Pdf.lic' is denied.
Exception Source: mscorlib
Exception 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)
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 ASP.global_asax.Application_Start(Object sender, EventArgs e)
Exception TargetSite: WinIOError
9:28:30 AM 11/17/2011 : An error occured: on 11/17/2011 9:28 AM
Exception Message: Access to the path 'C:\Inetpub\wwwroot\AsposeLic\Aspose.Pdf.lic' is denied.
Exception Source: mscorlib
Exception 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)
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 ASP.global_asax.Application_Start(Object sender, EventArgs e)
Exception TargetSite: WinIOError
=========================================================================== So it seems there are some additional permissions that needs to be set on the AsposeLic folder and the Aspose.words.Lic and Aspose.PDF.Lic
Could you please let me know what additional permissions needs to be set for the Licence to be set.
Mayur
I cannot use the solution provided in
https://forum.aspose.com/t/66344
The aspose licence will be shared between 2 applications, so I will like to create a folder one level above the application folder and hence the AsposeLic folder.
Regards
Hi
Thank you for additional information. No, there are not additional permissions required for license files. Your application must have read permissions to the folder where the license if placed. To make sure you have read permissions, you can try reading the license file into a stream in your application. I believe in this case, you will get exactly the same exception.
Since Web applications hosted in IIS are run under ASPNET (IUSR) user, you should make sure that these users have rights to read license file.
Best regards,