473,569 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Communications in ASP.NET


Hi All,

I've written an ASP.NET application (webservice) that does simple serial
communications via the .NET 2.0 SerialComm object.

The application runs fine on my development machine. The problem is when we
try to deploy it to another machine we receive: ACCESS IS DENIED TO COM1 PORT.

We have tried unsuccessfully to get this to work. We have tried the following:
1) Assign the IUSR.... account to Administrators
2) We have actually had the local administrator account run the webservice
3) rebooted
4) stopped and restarted IIS - etc. etc.

We are unable to resolve this. Is there a special permission that the
account needs? Once again we are running XP Pro and it works fine in
development but we can't get it to run on this other machine!!!!

Also - we have implemented the same code using a regular client application
and it works fine (i.e. copied all the code out and put it in a simple
windows form and we're fine).

The problem is running it as a webservice. It does not work!

Any thoughts - comments are appreciated! Thanks!

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.
May 31 '06 #1
5 2319
Your app is running as ASPNET not IUSR_ if I remember correctly. You can
change the user that the application pool that the application runs in. I
would however re-think your architecture as a webserver has no business
being connected to a serial port. I might make a remoting service that
handles the serial port then make a webservice front end.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com> wrote
in message news:F4******** *************** ***********@mic rosoft.com...

Hi All,

I've written an ASP.NET application (webservice) that does simple serial
communications via the .NET 2.0 SerialComm object.

The application runs fine on my development machine. The problem is when
we
try to deploy it to another machine we receive: ACCESS IS DENIED TO COM1
PORT.

We have tried unsuccessfully to get this to work. We have tried the
following:
1) Assign the IUSR.... account to Administrators
2) We have actually had the local administrator account run the
webservice
3) rebooted
4) stopped and restarted IIS - etc. etc.

We are unable to resolve this. Is there a special permission that the
account needs? Once again we are running XP Pro and it works fine in
development but we can't get it to run on this other machine!!!!

Also - we have implemented the same code using a regular client
application
and it works fine (i.e. copied all the code out and put it in a simple
windows form and we're fine).

The problem is running it as a webservice. It does not work!

Any thoughts - comments are appreciated! Thanks!

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.

May 31 '06 #2

Greg - what do you mean by "...I would however re-think your architecture
as a webserver has no business being connected to a serial port..."? I have
no idea of what you are talking about. If you call up VS 2005 - WebForms -
the SerialPort component is there waiting to be used. Why not use it? Also -
I have found many code examples illustrating exactly what I am successfully
doing already. And they're using ASP.NET. I don't understand this and I feel
embarassed...

I am just having troubles with the communications part of this.

--
Franklin M. Gauer III

"Greg Young" wrote:
Your app is running as ASPNET not IUSR_ if I remember correctly. You can
change the user that the application pool that the application runs in. I
would however re-think your architecture as a webserver has no business
being connected to a serial port. I might make a remoting service that
handles the serial port then make a webservice front end.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com> wrote
in message news:F4******** *************** ***********@mic rosoft.com...

Hi All,

I've written an ASP.NET application (webservice) that does simple serial
communications via the .NET 2.0 SerialComm object.

The application runs fine on my development machine. The problem is when
we
try to deploy it to another machine we receive: ACCESS IS DENIED TO COM1
PORT.

We have tried unsuccessfully to get this to work. We have tried the
following:
1) Assign the IUSR.... account to Administrators
2) We have actually had the local administrator account run the
webservice
3) rebooted
4) stopped and restarted IIS - etc. etc.

We are unable to resolve this. Is there a special permission that the
account needs? Once again we are running XP Pro and it works fine in
development but we can't get it to run on this other machine!!!!

Also - we have implemented the same code using a regular client
application
and it works fine (i.e. copied all the code out and put it in a simple
windows form and we're fine).

The problem is running it as a webservice. It does not work!

Any thoughts - comments are appreciated! Thanks!

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.


May 31 '06 #3

I'm sorry - I'm having troubles with the permissions part...

--
Franklin M. Gauer III

"Franklin M. Gauer III" wrote:

Greg - what do you mean by "...I would however re-think your architecture
as a webserver has no business being connected to a serial port..."? I have
no idea of what you are talking about. If you call up VS 2005 - WebForms -
the SerialPort component is there waiting to be used. Why not use it? Also -
I have found many code examples illustrating exactly what I am successfully
doing already. And they're using ASP.NET. I don't understand this and I feel
embarassed...

I am just having troubles with the communications part of this.

--
Franklin M. Gauer III

"Greg Young" wrote:
Your app is running as ASPNET not IUSR_ if I remember correctly. You can
change the user that the application pool that the application runs in. I
would however re-think your architecture as a webserver has no business
being connected to a serial port. I might make a remoting service that
handles the serial port then make a webservice front end.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com> wrote
in message news:F4******** *************** ***********@mic rosoft.com...

Hi All,

I've written an ASP.NET application (webservice) that does simple serial
communications via the .NET 2.0 SerialComm object.

The application runs fine on my development machine. The problem is when
we
try to deploy it to another machine we receive: ACCESS IS DENIED TO COM1
PORT.

We have tried unsuccessfully to get this to work. We have tried the
following:
1) Assign the IUSR.... account to Administrators
2) We have actually had the local administrator account run the
webservice
3) rebooted
4) stopped and restarted IIS - etc. etc.

We are unable to resolve this. Is there a special permission that the
account needs? Once again we are running XP Pro and it works fine in
development but we can't get it to run on this other machine!!!!

Also - we have implemented the same code using a regular client
application
and it works fine (i.e. copied all the code out and put it in a simple
windows form and we're fine).

The problem is running it as a webservice. It does not work!

Any thoughts - comments are appreciated! Thanks!

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.


May 31 '06 #4
Which part on the permissions?

As for my architecture comment.

The SerialPort would be owned by a single ASP.NET worker process
http://www.codeproject.com/aspnet/aspwp.asp (it would in fact belong to a
single app domain).. you could therefor only ever have a single ASP.NET
worker process... You could not scale yourself to support multiple worker
processes (let alone multiple web servers). You could not for instance run
with an application pool setup to use 10 worker processes (1 would work and
then 9 would fail to open the serial port).

As a rule of thumb, it is best to keep resources like this out of your web
processes as you can then scale the web processes.

http://www.microsoft.com/downloads/t...yLang=en&oRef=
is a useful document .. see "Resource Affinity" in chapter 6.

A perfect example of where this could kill your performance would be the
case where you are polling for a set of data that could be accessed throguh
your webservice via some data methods and exposed a few methods that caused
data to be executed accross the port. By moving the serial port out of the
web process you could feasably have 50 webservers using the same serial port
(in a case where they were mostly having people ask for data methods that
would simply hit their local cache this would in fact be a great
architecture).

The other problem I see alot of with this type of setup is that the ASP.NET
worker processes prefer to restart themselves occasionally. By placing the
serial port code in the web app you miss any polling etc over that port that
would need to be done during this period of time.

The last problem I see, you have already run into. Your code must run in at
an elevated privilege level which opens up far more sruface area for
possible attacks on your system (as opposed to a small component running
with elevated privs your entire app must now run with elevated privs or you
must take other measures within your application to only run certain areas
with elevated permissions). Doing something like making the ASPNET_WP
account an administrator on your system is certainly bad.

Have you tried to get the current identity to see who you are running as?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com> wrote
in message news:C8******** *************** ***********@mic rosoft.com...

I'm sorry - I'm having troubles with the permissions part...

--
Franklin M. Gauer III

"Franklin M. Gauer III" wrote:

Greg - what do you mean by "...I would however re-think your
architecture
as a webserver has no business being connected to a serial port..."? I
have
no idea of what you are talking about. If you call up VS 2005 -
WebForms -
the SerialPort component is there waiting to be used. Why not use it?
Also -
I have found many code examples illustrating exactly what I am
successfully
doing already. And they're using ASP.NET. I don't understand this and I
feel
embarassed...

I am just having troubles with the communications part of this.

--
Franklin M. Gauer III

"Greg Young" wrote:
> Your app is running as ASPNET not IUSR_ if I remember correctly. You
> can
> change the user that the application pool that the application runs in.
> I
> would however re-think your architecture as a webserver has no business
> being connected to a serial port. I might make a remoting service that
> handles the serial port then make a webservice front end.
>
> Cheers,
>
> Greg Young
> MVP - C#
> http://geekswithblogs.net/gyoung
> "Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com>
> wrote
> in message news:F4******** *************** ***********@mic rosoft.com...
> >
> > Hi All,
> >
> > I've written an ASP.NET application (webservice) that does simple
> > serial
> > communications via the .NET 2.0 SerialComm object.
> >
> > The application runs fine on my development machine. The problem is
> > when
> > we
> > try to deploy it to another machine we receive: ACCESS IS DENIED TO
> > COM1
> > PORT.
> >
> > We have tried unsuccessfully to get this to work. We have tried the
> > following:
> > 1) Assign the IUSR.... account to Administrators
> > 2) We have actually had the local administrator account run the
> > webservice
> > 3) rebooted
> > 4) stopped and restarted IIS - etc. etc.
> >
> > We are unable to resolve this. Is there a special permission that the
> > account needs? Once again we are running XP Pro and it works fine in
> > development but we can't get it to run on this other machine!!!!
> >
> > Also - we have implemented the same code using a regular client
> > application
> > and it works fine (i.e. copied all the code out and put it in a
> > simple
> > windows form and we're fine).
> >
> > The problem is running it as a webservice. It does not work!
> >
> > Any thoughts - comments are appreciated! Thanks!
> >
> > --
> > Franklin M. Gauer III
> > Applications Development Manager
> > Integrated Companies, Inc.
>
>
>

May 31 '06 #5

Thanks Greg for your clarifications. This has helped me out tremendously. I
appreciate it.

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.
"Greg Young" wrote:
Which part on the permissions?

As for my architecture comment.

The SerialPort would be owned by a single ASP.NET worker process
http://www.codeproject.com/aspnet/aspwp.asp (it would in fact belong to a
single app domain).. you could therefor only ever have a single ASP.NET
worker process... You could not scale yourself to support multiple worker
processes (let alone multiple web servers). You could not for instance run
with an application pool setup to use 10 worker processes (1 would work and
then 9 would fail to open the serial port).

As a rule of thumb, it is best to keep resources like this out of your web
processes as you can then scale the web processes.

http://www.microsoft.com/downloads/t...yLang=en&oRef=
is a useful document .. see "Resource Affinity" in chapter 6.

A perfect example of where this could kill your performance would be the
case where you are polling for a set of data that could be accessed throguh
your webservice via some data methods and exposed a few methods that caused
data to be executed accross the port. By moving the serial port out of the
web process you could feasably have 50 webservers using the same serial port
(in a case where they were mostly having people ask for data methods that
would simply hit their local cache this would in fact be a great
architecture).

The other problem I see alot of with this type of setup is that the ASP.NET
worker processes prefer to restart themselves occasionally. By placing the
serial port code in the web app you miss any polling etc over that port that
would need to be done during this period of time.

The last problem I see, you have already run into. Your code must run in at
an elevated privilege level which opens up far more sruface area for
possible attacks on your system (as opposed to a small component running
with elevated privs your entire app must now run with elevated privs or you
must take other measures within your application to only run certain areas
with elevated permissions). Doing something like making the ASPNET_WP
account an administrator on your system is certainly bad.

Have you tried to get the current identity to see who you are running as?

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com> wrote
in message news:C8******** *************** ***********@mic rosoft.com...

I'm sorry - I'm having troubles with the permissions part...

--
Franklin M. Gauer III

"Franklin M. Gauer III" wrote:

Greg - what do you mean by "...I would however re-think your
architecture
as a webserver has no business being connected to a serial port..."? I
have
no idea of what you are talking about. If you call up VS 2005 -
WebForms -
the SerialPort component is there waiting to be used. Why not use it?
Also -
I have found many code examples illustrating exactly what I am
successfully
doing already. And they're using ASP.NET. I don't understand this and I
feel
embarassed...

I am just having troubles with the communications part of this.

--
Franklin M. Gauer III

"Greg Young" wrote:

> Your app is running as ASPNET not IUSR_ if I remember correctly. You
> can
> change the user that the application pool that the application runs in.
> I
> would however re-think your architecture as a webserver has no business
> being connected to a serial port. I might make a remoting service that
> handles the serial port then make a webservice front end.
>
> Cheers,
>
> Greg Young
> MVP - C#
> http://geekswithblogs.net/gyoung
> "Franklin M. Gauer III" <Fr************ ***@discussions .microsoft.com>
> wrote
> in message news:F4******** *************** ***********@mic rosoft.com...
> >
> > Hi All,
> >
> > I've written an ASP.NET application (webservice) that does simple
> > serial
> > communications via the .NET 2.0 SerialComm object.
> >
> > The application runs fine on my development machine. The problem is
> > when
> > we
> > try to deploy it to another machine we receive: ACCESS IS DENIED TO
> > COM1
> > PORT.
> >
> > We have tried unsuccessfully to get this to work. We have tried the
> > following:
> > 1) Assign the IUSR.... account to Administrators
> > 2) We have actually had the local administrator account run the
> > webservice
> > 3) rebooted
> > 4) stopped and restarted IIS - etc. etc.
> >
> > We are unable to resolve this. Is there a special permission that the
> > account needs? Once again we are running XP Pro and it works fine in
> > development but we can't get it to run on this other machine!!!!
> >
> > Also - we have implemented the same code using a regular client
> > application
> > and it works fine (i.e. copied all the code out and put it in a
> > simple
> > windows form and we're fine).
> >
> > The problem is running it as a webservice. It does not work!
> >
> > Any thoughts - comments are appreciated! Thanks!
> >
> > --
> > Franklin M. Gauer III
> > Applications Development Manager
> > Integrated Companies, Inc.
>
>
>


Jun 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8810
by: Andreas Horneff | last post by:
Hi @ all, I've got a problem with serial communication in Borland C++ Builder. I've already found a lot of stuff about serial communication in the internet, but it dosen't work. What I want to do: I want to connect only one button to my com port. If the button is pressed,
6
6967
by: Peter Krikelis | last post by:
Hi All, I am having a problem setting up input mode for serial communications. (Sorry about the long code post). The following code is what I use to set up my comm port.
3
7899
by: Ramakant Kasar | last post by:
Hi, If an application is reading data from a serial port, How can I open the same serial port with another application? Any idea? Please help. Thanks, Ramakant K.
2
4881
by: K.K. | last post by:
I am writing program that will recieve or sent data to selected port (users can select which port they want to recieve or sent) but I don't know how or whick object I can use.
4
15820
by: Ben Zhu | last post by:
I have a small project, which need use both RS232 port and excel for data plot. I considering use excel VB macro for the entire project. Although I used serial port extensively in MFC, I am not sure how to open serial port from VB. Can anyone give me a little light? Really appreciated,
0
2474
by: David | last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003 application when attempting to open serial comms ports. The application has 2 ports that connect via serial cable to 2 different hardware devices to transfer binary data to the application. The setup screen enables the user to select COM1 -- COM8 via combo boax for...
4
2984
by: Gary Frank | last post by:
I'd like to write a program in VB.Net that handles serial communications to several devices. VB.Net 2003 does not have adequate built-in serial communications. I heard that 2005 will have that. Has this serial communications functionality been built into 2005 Beta yet? If so, is there any reason I can't get the Beta and create the program...
8
2457
by: vicky | last post by:
Hello,I met a question when I wrote the program.I want the program can transmit the data frame continuosly through the RS232 when the communication has been interrupted.But I don't know how to write. I don't know how to record.Who can give me hand?Thanks very much!
5
9482
by: LongBow | last post by:
Hello, Is there a way, in .NET, to determine what are the avialable Serial (Communications) Ports on a Windows OS and is there a way to determine that port isn't being use other than attempting to opening the Serial Port and catching the associated exception? Thanks If there isn't a way to determine the Serial Port within .NET I would be...
0
7625
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7935
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8144
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7992
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6313
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5244
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3677
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3666
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1235
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.