I referred this code snippet (http://stackoverflow.com/questions/2599925/how-to-print-pdf-on-default-network-printer-using-ghostscript-gswin32c-exe-she) and it worked very well. i can able to print a file silently from my wcf service.
But am getting a problem if i run this via IIS.
means "http://localhost:5030/mywcf" work perfectly.
if i change it to "http://172.16.16.1/mywcf" then am facing the following error. here is the stack trace.
-----------------------------------------------------
[06-18-12 03:38:48] GetSignoff(): The handle is invalid : at System.Diagnostics.Process.CreatePipeWithSecurityAttributes(SafeFileHandle& hReadPipe, SafeFileHandle& hWritePipe, SECURITY_ATTRIBUTES lpPipeAttributes, Int32 nSize)
at System.Diagnostics.Process.CreatePipe(SafeFileHandle& parentHandle, SafeFileHandle& childHandle, Boolean parentInputs)
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at XX.XX.PrintPDF.PrintVSPDF(String ghostScriptPath, Int32 numberOfCopies, String printerName, String pdfFileName) in D:\XX\Code\Server_MU\eBusiness\Business\PrintPDF.cs:line 551
at XX.Business.PrintPDF.Print(String patientId, String reportName, String loginId, String mailMessageId, String deviceId, String facilityId, String noteId) in D:\XX\Code\Server_MU\XX\Business\PrintPDF.cs:line 498
-------
and then i tried to execute the same command generated via cmd.exe which is working fine. any hint might be helpful.
thanks in advance.
rgds,
pa'1'
for this i got an work around. the post i did here for the different logic. holds goood for this requirement also.
html or pdf printing on server side c#
Regards,
Pavan N
Related
I've been having a problem getting a modified bolero app to perform HotReload. The problem appears to be in bolero-live as indicated by this top portion of the error log (line break inserted for convenience). However, the source code for bolero-live does not appear to be available despite the presence of its reference library code for the client and server projects, on github. I welcome any insight.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HLTL27BTITCT", Request id "0HLTL27BTITCT:00000001":
An unhandled exception was thrown by the application.
System.IO.DirectoryNotFoundException:
Could not find a part of the path '
/mnt/drive1/testproj/test1/src/test1.Serve/bin/Debug
/netstandard2.0/dist/_framework/_bin/test1.Client.dll
'
at Interop.ThrowExceptionForIoErrno(
ErrorInfo errorInfo, String path, Boolean isDirectory
,Func`2 errorRewriter
)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(
String path, OpenFlags flags, Int32 mode
)
at System.IO.FileStream..ctor(
String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options
)
at System.IO.FileStream..ctor(
String path, FileMode mode, FileAccess access
,FileShare share
)
at System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes)
at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
at Elmish.HotReload.Bolero.Cli.ListenerController.Update() in
/root/TeamCity/buildAgent/work/bbeb18eb622e1e0d/src
/bolero-live/ListenerController.fs
:line 39
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor
.AwaitableResultExecutor.Execute(
IActionResultTypeMapper mapper
,ObjectMethodExecutor executor
,Object controller, Object[] arguments
)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker
.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker
.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker
.Rethrow(ActionExecutedContext context)
bolero-live is different than the Bolero HotReload Templating implementation. bolero-live is supposed to reload the underlying dll as well, not just the front end. You can find the source code here
It unfortunately has not been heavily maintained or kept up to date with the latest Bolero versions (mostly as I've not had time to maintain it). The exception seems to indicate that the cli tool itself cannot find the newly made dll from FCSWatch.
bolero-live seems to be merely FCSWatch on github.com
I am trying to get data to export to Google Sheets using an api called DataEverywhere. I believe I've followed the instructions exactly, but they are kind of vague and there is no one I can call for support. Does anybody have any suggestions on what I may be doing wrong? Below is the error that I am getting when executing the DataEverywhere.exe file as well as the .ini file contents that it is referring to. Any help would be greatly appreciated.
C:\DataEverywhere>databaseconnector.exe -q WorkOrderDetails
Configuration parsed from connections.ini. 1 queries found.
Running query WorkOrderDetails
Error running query WorkOrderDetails.
ServiceStack.WebServiceException: Not Found
at ServiceStack.ServiceClientBase.ThrowWebServiceException[TResponse](Exception ex, String requestUri)
at ServiceStack.ServiceClientBase.ThrowResponseTypeException[TResponse](Object request, Exception ex, String requestUri)
at ServiceStack.ServiceClientBase.HandleResponseException[TResponse](Exception ex, Object request, String requestUri, Func`1 createWebRequest, Func`2 getResponse, TResponse& response)
at ServiceStack.ServiceClientBase.Send[TResponse](String httpMethod, String relativeOrAbsoluteUrl, Object request)
at DataEverywhere.DatabaseConnector.Utilities.QueryRunner.RunUpload(QueryConfiguration query)
Finished.
Here is my connections.ini file:
;
; YOU MUST DELETE THESE SAMPLE QUERIES IN ORDER FOR THE CONNECTOR TO RUN
; but feel free to edit these samples as a starting point for your own
; don't forget to edit the login information at the bottom
[Query WorkOrderDetails]
Database=OleDb
ConnectionString=Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\DataEverywhere\WorkOrderDetails.mdb;Persist Security Info=False;
Query=SELECT * from Test_Table
FeedId=8f5dcbc6-da73-4ccb-92aa-a184deca253d
[Data Everywhere]
Server=https://www.dataeverywhere.com
Email=debra#timacinc.com
Password=Password!
Context:
I have an update query for a Microsoft Access DB that keeps failing. The query works when executed from within my DB, but fails when executed from my CodeFile for my .aspx page.
I have ensured that:
My App_Data folder has write permissions (via IUSR)
My DB is not 'Read Only'
My query syntax is correct
Does anyone have any advice on what I might be missing? Thank you!!
Code:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI.WebControls
Imports System.Data.OleDb
Partial Class jsDB
Inherits System.Web.UI.Page
Private con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = C:\Dustin\App_Data\FAQ.accdb")
Public Sub Page_Load(sender as object, e as System.EventArgs)
If request.QueryString("type") = "helpful" Then
Dim cleanID as string
cleanID = request.querystring("id")
If IsNumeric(cint(cleanID)) Then 'Make sure QueryString hasn't been tampered with
Dim sql as string
sql = "UPDATE QUESTION SET helpful=helpful+1 WHERE questionID=" & cleanID
Dim cmd As New OleDbCommand(sql, con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Response.write("Success")
else
Response.write("Invalid ID")
end if
else
Response.write("No recognized type")
end If
End Sub
End Class
Error:
Server Error in '/' Application.
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.
Source Error:
Line 27:
Line 28: con.Open()
Line 29: cmd.ExecuteNonQuery()
Line 30: con.Close()
Line 31:
Source File: C:\Dustin\FAQDB.aspx.vb Line: 29
Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1102900
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +189
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +162
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +107
jsDB.Page_Load(Object sender, EventArgs e) in C:\Dustin\FAQDB.aspx.vb:29
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
This help page addresses the error you are receiving:
https://support.microsoft.com/en-us/kb/175168
It looks like either youre not opening the connection in the right mode (Mode 3 in this case) or the "table" you are updating has conditions which prevent you from updating it. I'd bet though that changing your Mode to 3 will resolve the issue.
There are several things done wrong here that may help you resolve this and other issues in the future.
IsNumeric(cint(cleanID)) - The IsNumeric() on CInt() is irrelevant. The CInt will either return a System.Int32 or an error. You should just do the IsNumeric() and if you want to know if it is an Int32, then do a Int32.TryParse() on it.
Your command should be parameterized to avoid injection and to avoid passing the wrong data type. For example, I don't know if questionID is a string (which makes your syntax wrong) or if it is an int32. But, a parameterized command would and will supply the correct syntax to your SQL. You can find thousands of example on ho to do this so I will not explain it again here.
The last item, and likely the solution, MS Access queries like to end in a semicolon (;). Seems like I have had issues in the past with not having them in my UPDATE commands for MS Access.
As a side-note. MS Access is terrible about handling multiple connections so leaving them open because of errors will cause you HUGE problems. Be sure that all database calls have proper error handling and if you can put them in a USING block, even better.
Shout-out to #Steve for being such a big help on this.
I had several issues here. While I'm sure there are many issues which could produce the error I was experiencing, here's what resolved it for me:
Created a new application pool in IIS and gave this new pool write permissions to my App_Data folder
Assigned this new app pool to my application
Modified the new app pool under advanced settings to allow 32 bit applications
As of right now, the 'Microsoft.ACE.OLEDB.12.0' provider only works as 32-bit. Changing my application pool to allow 32 bit applications resolved the issue.
Thanks all for your input!
I have the following vb.net code:
Imports IBM.WMQ
[...]
MQEnvironment.Hostname = hostName
MQEnvironment.Port = portNumber
MQEnvironment.Channel = channelName
queueManager = New MQQueueManager(queueManagerName) ' error here
which is throwing the following error:
System.IO.FileNotFoundException occurred
FileName=C:\Users\User\Documents\Visual Studio 2012\Projects\[...]\bin\Debug\mqclient.ini
HResult=-2147024894
Message=Could not find file 'C:\Users\User\Documents\Visual Studio 2012\Projects\[...]\bin\Debug\mqclient.ini'.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
I am not using any ini files in the construction of my queue manager, so does anyone have any idea what's going on - why is it even looking for one, and why in the same directory as the program? I have installed the MQ client, and afaik I have all the environmental variables, etc. set up properly.
Thanks for any help you can give
Is that an unhandled or a first chance exception? Internally, the MQ .net layer will try to read a MQClient.ini but should function quite happily without it. It reads the file for compatibility with the C client, and can handle some of the MQClient.ini stanzas. I would not have expected an absence of such a file to cause problems, but it will try to open it internally. Was that the full callstack, as I'd have expected some MQ libraries on the stack otherwise.
I'm trying to write a windows service. It installs fine, but fails when I run it with the following exception. I've searched for the string "MyNewProgramService", but I can't find any conversions that would throw this error. I've also added try/catch blocks to a bunch of code with custom exception handling without finding where this exception is occuring. I'm thinking it's somewhere in the auto-generated configuartion/setup code. Any ideas?
Event Type: Error
Event Source: MyNewProgram Event
Category: None Event
ID: 0
Date: 4/15/2010
Time: 12:48:34 PM
User: N/A
Computer: 20F7KF1
Description: Service cannot be started. System.InvalidCastException:
Conversion from string "MyNewProgramService" to type 'Integer' is not valid. --->
System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value,
NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at TaskManagerFailureHandlerService.MyNewProgramService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
it falls in method MyNewProgramService.OnStart, there Conversions.ToInteger is called somewhere. Just search for it in method. Then check parameter. It might come from config or something, thats why you don't see string in text.
Check your configuration file.
You might also check the account the service is running as. Just as a test go to the login tab in the services list and have it login under your own account. If the problem vanishes it's a permissions problem.