Hi !
I have to invoke a batch file (.bat) when an ad-hoc report is executed. I've currently written a .Net code for invoking (using System.Diagnostics.Process) the batch file. The rdl file calls the method.
When I run the report from Report Designer the batch file is getting executed. But if I deploy it in the Reporting Server and run the report through Web Interface the batch file is not getting executed.
Looks like some security issue. Can someone provide a solution for this?
Thanks.
Where did you place the batch file ? All commands executed either in Script or custom code or executed on the server not on the client.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
Hi Jens,
Thanks for the reply.
I placed the batch file in the server. I also moved the code (to invoke a batch file using System.Diagnostics.Process class) to a VB.Net dll and tried invoking the function from the rdl. The function is not getting invoked. I also added SecurityPermissionAttribute to the class. Is there any other Security permission that needs to be added for the code to be accessed.
Please find below the sample:
Public Shared Function fnRunSPX(ByVal x As String, ByVal y As String, ByVal z As String, ByVal w As String)
Dim Pro As New System.Diagnostics.Process
Dim Elog As New System.Diagnostics.EventLog
If Not Elog.SourceExists("BillingDateBatch") Then
Elog.CreateEventSource("BillingDateBatch", "Application")
End If
Dim EventLog1 As New System.Diagnostics.EventLog
EventLog1.Source = "BillingDateBatch"
EventLog1.Log = "Application"
EventLog1.WriteEntry("Success", System.Diagnostics.EventLogEntryType.SuccessAudit)
Pro.StartInfo.FileName = "C:\\batch.bat"
Pro.StartInfo.Arguments = x + " " + y + " " + z + " " + w
Pro.Start()
Pro.WaitForExit()
End Function
Even the evenlogging (present in teh above code) does not happen. Please let me know if you have any questions.
Thanks,
Aravind
No comments:
Post a Comment