I have encountered the error "CryptoAPI cryptographic service provider (CSP) for this implementation could not be acquired." when I execute the WebService below. This currently works in production with the old license scheme but after changing to the new license and modifying the code to use it, it has problems when setting up the license for the PDF object. Below is the code that is being executed.
Please advise on how to fix this problem.
I have noted where the code actually exceptions out with the following:
StackTrace: " at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.RSACryptoServiceProvider..ctor()
at Aspose.Pdf.License.a(XmlNode A_0, XmlNode A_1)
at Aspose.Pdf.License.a(XmlDocument A_0)
at Aspose.Pdf.License.SetLicense(Stream stream)
at Aspose.Pdf.License.SetLicense(String licenseName)
at ws_rpmOffice_v1.WS_RPMOffice_V1.RPMWordDocToPDF(String inUNC, String outUNC, String strUserLogon) in xxx.vb:line 222"
--------------------------------------------
<System.Web.Services.WebMethod( _ Dim RtnVal As String = String.Empty Dim InPath As String = inUNC.Trim If Not File.Exists(InPath) Then If strUserLogon.Trim.Length = 0 Then 'Determine if ASPOSE License is avalible for use; otherwise watermarked output will be created (for testing servers) Dim PDFLicense As String = GetWebConfigAppValue("ASPOSEPDFLicenseFile") 'Delete Temp Work file Dim DirName As String = fi.DirectoryName If File.Exists(FileName) Then File.Delete(FileName) Try Dim objDocument As WORD.Document = New WORD.Document(InPath) 'Create PDF If PDFLicense.Length > 0 Then ''''''' THE NEXT LINE IS WHERE IT ABENDS objPDF.BindXML(wrkFile, Nothing) 'Add Timestamp Note. 'Attach Timestamp to file Dim sec1 As PDF.Section = objPDF.Sections.Add() Dim table1 As PDF.Table = New PDF.Table Dim row1 As PDF.Row = table1.Rows.Add() Dim cell1Row1 As PDF.Cell = row1.Cells.Add(strTimestamp) If File.Exists(OutPath) Then objPDF.Save(OutPath) If Not File.Exists(OutPath) Then Catch ex As Exception Try Return RtnVal End Function |
Please let me know what should be done to correct the problem. As stated earlier, this is working in production but after the new key and modifications it does not work. If I remove the second license call for the PDF object it works well but the output has a watermark.
Thanks for the help.
Dave