Windows Service crashes in FW Ver 2.0

G

Guest

I have a Windows Service that I created in .NET version 1.1 and it runs under
the system account.

I created a Windows XP SP2 Virtual PC (in Microsoft Virtual PC 2007) that
has the latest updates.
From this base VPC I created 2 new VPCs. One that has framework version 1.1
installed (and any windows updates this caused to be installed) and one that
has framework version 2.0 installed (also with any windows updates this
caused to be installed).

My service runs fine on version 1.1.
My service crashes on the 2.0 version with the following stack dump:

The exception "ArgumentException" has occurred in "mscorlib"
Additional Info:Value does not fall within the expected range.
Stack dump:
at System.String.nativeCompareOrdinal(String strA, String strB, Boolean
bIgnoreCase)
at System.String.Compare(String strA, String strB, StringComparison
comparisonType)
at System.Diagnostics.PerformanceCounter.set_CategoryName(String value)
at System.Net.NetworkingPerfCounters.Initialize()
at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection
section)
at System.Net.Configuration.SettingsSectionInternal.get_Section()
at System.Net.Sockets.Socket.get_CanUseAcceptEx()
at System.Net.Sockets.Socket.BeginAccept(AsyncCallback callback, Object
state)
at System.Net.Sockets.TcpListener.BeginAcceptSocket(AsyncCallback
callback, Object state)
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(Object
data)
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary
properties, IServerChannelSinkProvider sinkProvider,
IAuthorizeRemotingConnection authorizeCallback)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary
properties, IClientChannelSinkProvider clientSinkProvider,
IServerChannelSinkProvider serverSinkProvider)
at MyService.ListenThread()

The exception is being thrown in a string compare!? So, what broke in
version 2.0?
Thanks for any help
 
M

Michael Nemtsev, MVP

Hello dlgproc,

Did u use the same localized windows versioin?
Do u have .net 1.1 installed on that PC with .NET 2.0?
Did u try to specify in service config the probing to the .NET 2.0 assemblies?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


d> I have a Windows Service that I created in .NET version 1.1 and it
d> runs under the system account.
d>
d> I created a Windows XP SP2 Virtual PC (in Microsoft Virtual PC 2007)
d> that
d> has the latest updates.
d> From this base VPC I created 2 new VPCs. One that has framework
d> version 1.1
d> installed (and any windows updates this caused to be installed) and
d> one that
d> has framework version 2.0 installed (also with any windows updates
d> this
d> caused to be installed).
d> My service runs fine on version 1.1.
d> My service crashes on the 2.0 version with the following stack dump:
d> The exception "ArgumentException" has occurred in "mscorlib"
d> Additional Info:Value does not fall within the expected range.
d> Stack dump:
d> at System.String.nativeCompareOrdinal(String strA, String strB,
d> Boolean
d> bIgnoreCase)
d> at System.String.Compare(String strA, String strB,
d> StringComparison
d> comparisonType)
d> at System.Diagnostics.PerformanceCounter.set_CategoryName(String
d> value)
d> at System.Net.NetworkingPerfCounters.Initialize()
d> at
d> System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSectio
d> n
d> section)
d> at System.Net.Configuration.SettingsSectionInternal.get_Section()
d> at System.Net.Sockets.Socket.get_CanUseAcceptEx()
d> at System.Net.Sockets.Socket.BeginAccept(AsyncCallback callback,
d> Object
d> state)
d> at System.Net.Sockets.TcpListener.BeginAcceptSocket(AsyncCallback
d> callback, Object state)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(
d> Object
d> data)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictiona
d> ry
d> properties, IServerChannelSinkProvider sinkProvider,
d> IAuthorizeRemotingConnection authorizeCallback)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary
d> properties, IClientChannelSinkProvider clientSinkProvider,
d> IServerChannelSinkProvider serverSinkProvider)
d> at MyService.ListenThread()
d> The exception is being thrown in a string compare!? So, what broke in
d> version 2.0?
d> Thanks for any help
 
G

Guest

Did u use the same localized windows versioin?
Yes. Both VPCs were copies of the same install of Windows XP SP2
Do u have .net 1.1 installed on that PC with .NET 2.0?
No. I made a copy of the orginal VPC and installed Version 1.1 on it. Then I
made another copy from the original VPC and installed 2.0 on that one.
Did u try to specify in service config the probing to the .NET 2.0 assemblies?
No. Can you point me to some documentation on how to do that and please
explain what that can give me to help debug the issue?

Thank you very much for your help.


Hello dlgproc,

Did u use the same localized windows versioin?
Do u have .net 1.1 installed on that PC with .NET 2.0?
Did u try to specify in service config the probing to the .NET 2.0 assemblies?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


d> I have a Windows Service that I created in .NET version 1.1 and it
d> runs under the system account.
d>
d> I created a Windows XP SP2 Virtual PC (in Microsoft Virtual PC 2007)
d> that
d> has the latest updates.
d> From this base VPC I created 2 new VPCs. One that has framework
d> version 1.1
d> installed (and any windows updates this caused to be installed) and
d> one that
d> has framework version 2.0 installed (also with any windows updates
d> this
d> caused to be installed).
d> My service runs fine on version 1.1.
d> My service crashes on the 2.0 version with the following stack dump:
d> The exception "ArgumentException" has occurred in "mscorlib"
d> Additional Info:Value does not fall within the expected range.
d> Stack dump:
d> at System.String.nativeCompareOrdinal(String strA, String strB,
d> Boolean
d> bIgnoreCase)
d> at System.String.Compare(String strA, String strB,
d> StringComparison
d> comparisonType)
d> at System.Diagnostics.PerformanceCounter.set_CategoryName(String
d> value)
d> at System.Net.NetworkingPerfCounters.Initialize()
d> at
d> System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSectio
d> n
d> section)
d> at System.Net.Configuration.SettingsSectionInternal.get_Section()
d> at System.Net.Sockets.Socket.get_CanUseAcceptEx()
d> at System.Net.Sockets.Socket.BeginAccept(AsyncCallback callback,
d> Object
d> state)
d> at System.Net.Sockets.TcpListener.BeginAcceptSocket(AsyncCallback
d> callback, Object state)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(
d> Object
d> data)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictiona
d> ry
d> properties, IServerChannelSinkProvider sinkProvider,
d> IAuthorizeRemotingConnection authorizeCallback)
d> at
d> System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary
d> properties, IClientChannelSinkProvider clientSinkProvider,
d> IServerChannelSinkProvider serverSinkProvider)
d> at MyService.ListenThread()
d> The exception is being thrown in a string compare!? So, what broke in
d> version 2.0?
d> Thanks for any help
 
M

Michael Nemtsev, MVP

Hello dlgproc,

Try to set the .NET supported runtime to 2.0 as described there http://msdn2.microsoft.com/en-us/library/d5cd9b2c.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

d> No. Can you point me to some documentation on how to do that and
d> please explain what that can give me to help debug the issue?
d>
 
G

Guest

Hi Michael,
Thanks for the suggestion. Unfortunately, I’m still getting the same
exception. I tried both of the following configurations with no success.

<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

<configuration>
<runtime>
<compatibilityversion major="1" minor="0"/>
</runtime>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

I don’t know if this makes a difference but I also have a Deployment project
in my service solution. In order for my service to even install on the VPC, I
had to change the Launch Condition I put in the project to say it supports
the following runtimes: 1.1.4322;2.0.50727. Originally, I just had this set
to 1.1.4322 and when I tried to install it I got the following error:

The setup requires the .NET Framework version 1.1.4322.
Please install the .NET Framework and run this setup again.

I’m not sure I understand this. I thought that when I installed the 2.0
version of the runtime, all previous versions were installed as well for
backwards compatibility. Why does the installer baulk at me that 1.1.4322 is
not installed when 2.0.50727 is? Or is it just not smart enough to know that
the “Active†version of the framework includes the one it requires?

Thanks for your help.

Hello dlgproc,

Try to set the .NET supported runtime to 2.0 as described there http://msdn2.microsoft.com/en-us/library/d5cd9b2c.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

d> No. Can you point me to some documentation on how to do that and
d> please explain what that can give me to help debug the issue?
d>
 
G

Guest

Just a thought, could this be a privileges issue? Maybe something to do with
the SYSTEM account itself? When I run the installer to install my service,
it’s running under the Administrator account. In the installer component, I
have code that starts the service; and it starts fine with no issues. However
after installation, if the service is stopped (using Services.msc in Control
Panel | Administrative Tools) and then the attempt is made to start the
service again, that is when the exception is thrown.

Hello dlgproc,

Try to set the .NET supported runtime to 2.0 as described there http://msdn2.microsoft.com/en-us/library/d5cd9b2c.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

d> No. Can you point me to some documentation on how to do that and
d> please explain what that can give me to help debug the issue?
d>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top