We have a frankenstein webservice that I’ve been fixing a problem with pdf production and everything is working as expected in Debug but when I publish to the test IIS7 server it runs but I don’t get the PDF.
The website callse this function and passes in the claimId
Public Function QServices_QAudit_GetWorkersCompCoverPage(ByVal claimId As Long) As Byte()
Dim sess As General.Session = Session.Item("sessionObject")
Dim pdfDocument As System.IO.MemoryStream
If Not AuthorizeUser(sess, Context, "qaudit") Then Return Nothing
pdfDocument = QAudit.QAuditData.GetWorkersCompCoverPage(claimId, sess)
If pdfDocument Is Nothing Then Return Nothing
Dim retValue As Byte()
ReDim retValue(0 To pdfDocument.Length - 1)
Dim i As Long
pdfDocument.Seek(0, IO.SeekOrigin.Begin)
For i = 0 To pdfDocument.Length - 1
retValue(i) = pdfDocument.ReadByte()
Next
Return retValue
End Function
Which in turn calls a function which reads in a pdf form, populates the fields saves it to the file system then converts it to a memory stream and returns it. Its converted to a byte stream and sent back to the website. Everything works great in debug but after publish, the pdf never gets saved. I’m thinking a permissions issue on either the folder that holds the blank pdf form or the folder that we write the completed form to, but I’ve given every permission I can think of including Network Services. IUSR, IIS_USRS and Authenticated Users but no change in the result. I’ve set the Application pool to Network Service, Local Service, Local System and the default and still no joy.
Any ideas on if there is another permission set I’m missing or something else in IIS7 that is preventing the file reading/writing?
Finally getting back to this one but learned it was a combination of IIS 7 loosing folder permissions every time we published the website and the app pool permissions of the webservice since it was running on a different level of .net. Basically we moved the pdf logic from the webservice to the website appcode folder and gave the local iis user permissions on this folder (through IIS, not through windows explorer) and everything is stable.