.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

Serial port open fails because application and spoolsv.exe both try to access: Is this a .NET bug or

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework
 
Dear all,
after browsing around I could not find any answer to my issue.

I'm writing a program in C# to access a serial device. The serial device comes with a legacy DLL probably written in C++ that provides an OpenDevice (which I call via DLLImport). The device is connected to a USB port via a Prolific USB to serial converter.
My problem is that 1 out of 5 times, the OpenDevice fails when I run my application. I have workaround to call it until it succeeds and it never goes beyond 3 or 4 tries.
By monitoring the serial port with Portmon I noticed that:
1) when running the application in debug mode from Visual studio the Com port is open from my process (MyApplication.EXE)
2) when running from command line the Com port communication belongs to windows print spooler service (spoolsv.exe) but Portmon also tracks an open command from MyApplication.EXE and here the collision happens: I'm suprised to see that the main communication is managed by spoolsv.exe so it is not just spoolsv.exe running in the background: I'm calling it!
3) the demo software from the supplier uses the same DLL but it is written in C++ and when I run it spoolsv.exe does not show up

Does anybody have an insight on serial port handling in .NET when a legacy DLL and a serial to USB converter are on the path? I would like to connect directly


View Complete Post


More Related Resource Links

.NET bug or my fault?: Serial port fail to open from C# because spoolsv.exe and my application try t

  
Dear all,
after browsing around I could not find any answer to my issue.

I'm writing a program in C# to access a serial device. The serial device comes with a legacy DLL probably written in C++ that provides an OpenDevice (which I call via DLLImport). The device is connected to a USB port via a Prolific USB to serial converter.
My problem is that 1 out of 5 times, the OpenDevice fails when I run my application. I have workaround to call it until it succeeds and it never goes beyond 3 or 4 tries.
By monitoring the serial port with Portmon I noticed that:
1) when running the application in debug mode from Visual studio the Com port is open from my process (MyApplication.EXE)
2) when running from windows the Com port communication belongs to windows print spooler service (spoolsv.exe) but Portmon also tracks an open command from MyApplication.EXE and here the collision happens: I'm suprised to see that the main communication from MyApplication is managed by spoolsv.exe so it is not just spoolsv.exe running in the background: I'm calling it!
3) the demo software from the supplier uses the same DLL but it is written in C++ and when I run it, spoolsv.exe does not show up (and open port never fails!)

I do not understand what is the trigger that makes the calls going through spoolsv.exe or directly to the port and

Serial Port Application Leaks Handle After Exit Forcing Reboot to Clear

  

The application (C# .Net 3.5) available at www.redondowa.com/porttest demonstrates a problem encountered with a Sony VAIO multimedia laptop related to use of its serial modem port.  A discussion with MS support is included in a doc with the VS solution.

If the base stream or port is not closed before nulling the port, the port cannot be recreated and the application leaves the port inaccessible.  The machine requires a reboot to clear the error.  Other machines clear the error without requiring a reboot.

<!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:"Arial Unicode MS"; mso-font-charset:134; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"\@SimSun"; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:134; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch

Serial port access - COM1 denied

  

I am writing a web application that needs to communicate with a serial port. Actually, it used to be a win forms app which I am re-doing. Now, in win forms app the port COM1 is opened and read successfully. The app is run on WinCE 5.0 thin client and I use serial port control with Framework 2.0.

The app is accessed on WinCE 5.0 thin client (physically the same machine as Windows forms app above). When I access the web app on IE, and attempt to open the serial port is tells me the access is denied.  Even though using SerialPort.GetPortNames I get COM1 and COM2 as available ports.

 

How come this is happening? And how do I fix it? It seems to be a security issue to do with IE (since these ports work fine on Windows forms application).

Any ideas?

Thanks! 

 

 


"Actions / Open With Access" Always Fails with Access 2007.

  

Hello,

I am trying to open a List with the Actions / Link with Access functionality.  Every time I try, it simply opens up the MS Access interface as though I had gone through the Start button and selected MS Access.  However, it shows the name of the database, in the right side panel, that was in the "Open with Microsoft Access" dialog box that opens after you select Link with Access.  If you click on the database name, I get an error box saying that the database doesn't exist.

The caveat here is that it used to work.  I have a database that I have been using to run reports and custom queries on a List.  Now, if I click on the Linked Table, I get the error message "You do not have the necessary permissions to use the '[object]' object.  Have your sys admin or the person who created the object establish teh appropriate permissions for you." 

I am the one who created the list and I have admin rights to this area of Sharepoint.

I have also tried to perform the same tasks to another Sharepoint site where I have full Admin rights over the entire site.  Same problem.

The version of Sharepoint is 12.0.0.6539.

I also have MS Office 2003, Project and Visio, installed on my PC.

Any ideas or thoughts on what the problem may be?  Our Sharepoint techs and our

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

  
The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

bluetooth print via serial port PDA

  
Print via BlueTooth using PDA

Serial Port Communication Read and Write using C#.net

  
In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
C#:
---
using System.IO.Ports

VB
Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

Microsoft Application Block for Data Access in .NET

  

Hi all,

I was rummaging the internet learning aspx and came across the concept of: Microsoft Application Block for Data Access in .NET

It seems great of course. The articles are all early 2003-5 such as

http://www.codeproject.com/KB/database/MS_Application_Blocks.aspx

So the question is - is this tech still relevant and should I be using it?

Thanks,

Mat



Data Access: Building a Desktop To-Do Application with NHibernate

  

Building an NHibernate-based desktop application isn't any harder than building a web application, and in many cases NHibernate simplifies elements of session handling and concurrency.

Oren Eini

MSDN Magazine December 2009


Data Points: The Enterprise Library Data Access Application Block, Part 3

  

E nterprise applications can have a wide variety of data update requirements. Sometimes you need to save multiple rows of changes at once within a single transaction. Other times, the user must be allowed to enter multiple rows of data, send them to the database in a batch; and if a row or two fails, only the rows that succeeded should be committed and remain committed.

John Papa

MSDN Magazine October 2005


Data Points: The Enterprise Library Data Access Application Block, Part 2

  

Last month I explored the foundation of the Enterprise Library Data Access Application Block (DAAB) including how it all fits into an architecture (see Data Points: The Enterprise Library Data Access Application Block, Part 1).

John Papa

MSDN Magazine August 2005


Data Points: The Enterprise Library Data Access Application Block, Part 1

  

A solid data access later (DAL) can benefit an application by hiding redundant tasks, helping handle exceptions more gracefully, helping clean up resources more efficiently, and providing a layer of abstraction from the database.

John Papa

MSDN Magazine July 2005


Upsize Your Database: Convert Your Microsoft Access Application to Take Advantage of SQL Server 7.0

  

What if you need to convert an existing Microsoft Access 97 database application into a true client-server application that is based on a SQL Server back end? If you know a little about Visual Basic and SQL Server, it's easy to make your app take advantage of the power and scalability provided by SQL Server 7.0. Using some concrete code examples, this article takes you step by step through converting the native Jet queries in your Access application into stored procedures and pass-through queries that SQL Server can use. You'll also learn how to pass on parameters when your client-server app calls these SQL Server stored procedures and queries.

Michael McManus

MSDN Magazine June 2000


Open a windows application form names in another

  
Hi, Now i am in a horrible situation. I want to create an application for open another application(exe) and display all the form names in newly opened application in a compobox.If we selected a compobox item,ie;a form name in new application opened,i want to display all the control names in that form... is it possible? we can do it in same application.but how can i do it in another application? thanks in advance   Anoop

Remotely access winform application through admin panel

  
I am going to develop following application but not sure how to do this   Application will run different instances for various clients on different servers.     Each instance will run on different criteria stored in database managed by an admin.     Would like to be able to run this from the admin section.     Maybe using a server command line component and pipin the output into a web based admin? -- Whatever you think is best.     This application will run basically 24-7   Any best solution, idea etc

Serial Port with portable data terminal

  
Hi,I am making application with portable data terminal which connected to serial port. User will go with portable data terminal and scan data with it than we will connect it to PC and read all the data from it. Kindly somebody help me how to do that.Thanx

How to wait for a Serial Port to respond

  
Hi Is it to possible to wait for a serialPort component to complete it's response?  I have a device connected to the serial port of my PC. I use the serialPort component in order to communicate with the device. I have to send 2 different strings of data to the serial port but the trick is that after sending the first string of data I have to wait for the serial port to respond. Then I have to check the response and decide whether I must send the second string or not. Also after sending the second string, I have to check also the response of the serial port. I tried to use an arbitrary amount of wait time between the sending of the two strings. Something like SerialPort.Write(...) ; Thread.Sleep(2000); SerialPort.Write(...); But the software failed when I tried it in a slower PC. So is there a way to replace the Thread.Sleep(2000) with a command that will wait until the serial port complete its response? Although, the response of the serial port is different between the two sending strings, I do know that the first response is only one byte and I know the ending byte of the second response. Also, the second response is no more than 30 bytes in length. Regards Dimitris
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend