Windows Service Fails on Launch - vb.net

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.

Related

Debug exception in tRootTask in VxWorks

Using VxWorks A653 v2.5.0.2 I am getting an exception being generated in tRootTask during startup:
data storage
Exception current instruction address: 0x50000120
Machine Status Register: 0x0000fb30
Data Exception Address Register: 0x00000008
Integer Exception Register XER: 0x00000000
Condition Register: 0x40000088
Exception Syndrome Register: 0x01000000
Partition Domain ID: 0x007539a0
Task: 0x521f5920 "tRootTask"
the tRootTask does spawn a number of other kernel tasks and also creates a task for the user partition. But the entry point to the user task in the user partition never seems to run (printf() statement is not hit). After the exception occurs it is possible to attach a debugger, but the tRootTask itself is deleted by the exception. If I access the shell after the exception, attempting to display the contents at 0x50000000 contains fails, as if it is unmapped memory. This may be the root cause of the exception, but why it's inaccessible is unclear.
So I am searching for a way to debug why the exception is happening. I'm new to this OS.itself
Look in your linker map for the
"Exception current instruction address: 0x50000120"
Or if the shell has "lkup"
-> lkup 0x50000120
should give the nearest global function that's throwing exception.
Data Exception Address Register: 0x00000008
looks like zero page access, but you need decipher the "Exception Syndrome Register" in PowerPC manual to see if it's the right condition code?
"tRootTask" is the first thread in the context, so it's some sort of startup code that's failing. But it's so early, you probably need a JTAG debugger to get a breakpoint on it.

Specified argument was out of the range of valid values. Parameter name: mode

When I click the application pools on iis8,it threw the exception like title.I have reinstalled iis8,but it was no use.

MQQueueManager Constructor throwing FileNotFoundException

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.

Regions/Locales and Pulling DateTimes( From Strings) from a Database

I've been having several problems lately with clients that are using a different Windows Region setting than I am. I cannot seem to find a way to fix it. The error is as follows:
The type initializer for 'InventoryDataTable' threw an exception. ---> System.TypeInitializationException: The type initializer for 'InventoryDataTable' threw an exception. ---> System.FormatException: String was not recognized as a valid DateTime.
The error occurs when users load the application and their region settings do not match my own. The application loads up a dataset and attempts to receive a small amount of data before allowing the user to log in. When this is removed, the problem occurs immediately after the user logs in to the app.
I cannot seem to find the proper settings to force the user to use either my Region, or to allow the application to figure it out on it's own...
Exact error:
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'InventoryDataTable' threw an exception. ---> System.TypeInitializationException: The type initializer for 'InventoryDataTable' threw an exception. ---> System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s)
at Invasion_3042_v2.INVDataSet.InventoryDataTable..cctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 7588
--- End of inner exception stack trace ---
at Invasion_3042_v2.INVDataSet.InventoryDataTable..ctor()
at Invasion_3042_v2.INVDataSet.InitClass() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 4296
at Invasion_3042_v2.INVDataSet..ctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 447
at Invasion_3042_v2.INV3042LOGIN.InitializeComponent() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INV3042LOGIN.Designer.vb:line 39
at Invasion_3042_v2.INV3042LOGIN..ctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INV3042LOGIN.vb:line 100
--- End of inner exception stack trace ---
at Invasion_3042_v2.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Invasion_3042_v2.My.MyProject.MyForms.get_INV3042LOGIN()
at Invasion_3042_v2.My.MyApplication.OnCreateMainForm() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
Posting the actual code causing the issue would have helped, but I can put forth a pretty good guess at what's going on.
Could it be that the date format being stored into your centralized database is always of a given format (maybe US?). If so, what is very likely happening is the following:
A date like 1/14/2012 is returned from a query to your database. The code running on your problem clients are parsing the date using perhaps European date regional settings. (In the EU and most other countries in the world 14-Jan-2012 is expressed as 14/01/2012 aka dd/MM/yyyy, not MM/dd/yyyy.
Try either specifying that you want to always use a known, base regional setting in your config file like this:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" />
...or parse your dates using a specified culture setting like this to avoid defaulting to the local system setting that does not match your server-side expectations.
DateTime.Parse("1/14/2012", new CultureInfo("en-US")); // or whatever culture your server database expects...

WCF: The server method 'MyMethod' failed

The WCF service is deployed on different machine.
Im able to get the http://MyServer/MYService.svc/jsdebug file by giving
<identity>
<dns value="ServerName and the portnumber"/>
And I'm able to invoke the service method using javascript.
After invoking the MyMethod.
I get this error in the javascript --> The server method 'MyMethod' failed, status 404 (in failedCallback)
MyMethod returns a Boolean value in svc.cs file after performing a datacheck.
These are the errors came up when I used Firefox Firebug:
When I call the same service using VS2008 in my development environment it works fine.
I found that following are the files which are not loading while using Ajax enabled VS2005
1) MicrosoftAjax.debug.js(3.5)
2) MicrosoftAjaxWebForms.debug.js(3.5) During runtime
Its obvious that 3.5 debug files doesn't load but, 1.0.6 debug files should load without the errors displayed below.
invokeCalledTwice":"Cannot call invoke more than once.",
11"webServiceFailed":"The server method \u0027{0}\u0027 failed with the following error: {1}",
12"argumentType":"Object cannot be converted to the required type.",
13"argumentNull":"Value cannot be null.",
14"controlCantSetId":"The id property can\u0027t be set on a control.",
15"formatBadFormatSpecifier":"Format specifier was invalid.",
16"webServiceFailedNoMsg":"The server method \u0027{0}\u0027 failed.",
17"argumentDomElement":"Value must be a DOM element.",
18"invalidExecutorType":"Could not create a valid Sys.Net.WebRequestExecutor from: {0}.",
19"cannotCallBeforeResponse":"Cannot call {0} when responseAvailable is false.",
20"actualValue":"Actual value was {0}.",
21"enumInvalidValue":"\u0027{0}\u0027 is not a valid value for enum {1}.",
22"scriptLoadFailed":"The script \u0027{0}\u0027 could not be loaded.",
23"parameterCount":"Parameter count mismatch.",
24"cannotDeserializeEmptyString":"Cannot deserialize empty string.",
25"formatInvalidString":"Input string was not in a correct format.",
26"invalidTimeout":"Value must be greater than or equal to zero.",
27"cannotAbortBeforeStart":"Cannot abort when executor has not started.",
28"argument":"Value does not fall within the expected range.",
29"cannotDeserializeInvalidJson":"Cannot deserialize. The data does not correspond to valid JSON.",
30"invalidHttpVerb":"httpVerb cannot be set to an empty or null string.",
31"nullWebRequest":"Cannot call executeRequest with a null webRequest.",
32"eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler method.",
33"cannotSerializeNonFiniteNumbers":"Cannot serialize non finite numbers.",
34"argumentUndefined":"Value cannot be undefined.",
35"webServiceInvalidReturnType":"The server method \u0027{0}\u0027 returned an invalid type. Expected type: {1}",
36"servicePathNotSet":"The path to the web service has not been set.",
37"argumentTypeWithTypes":"Object of type \u0027{0}\u0027 cannot be converted to type \u0027{1}\u0027.",
38"cannotCallOnceStarted":"Cannot call {0} once started.",
39"badBaseUrl1":"Base URL does not contain ://.",
40"badBaseUrl2":"Base URL does not contain another /.",
41"badBaseUrl3":"Cannot find last / in base URL.",
42"setExecutorAfterActive":"Cannot set executor after it has become active.",
43"paramName":"Parameter name: {0}",
44"cannotCallOutsideHandler":"Cannot call {0} outside of a completed event handler.",
45"format":"One of the identified items was in an invalid format.",
46"assertFailedCaller":"Assertion Failed: {0}\r\nat {1}",
47"argumentOutOfRange":"Specified argument was out of the range of valid values.",
48"webServiceTimedOut":"The server method \u0027{0}\u0027 timed out.",
49"notImplemented":"The method or operation is not implemented.",
50"assertFailed":"Assertion Failed: {0}",
51"invalidOperation":"Operation is not valid due to the current state of the object.",
52"breakIntoDebugger":"{0}\r\n\r\nBreak into debugger?"
Appreciate your inputs.
Seeing as you have Firebug installed, you can use it to check the HTTP request and response to see if they contain more information about what went wrong.
These are the errors came up when I used Firefox Firebug:
When I call the same service using VS2008 in my development environment it works fine.
I found that following are the files which are not loading while using Ajax enabled VS2005
1) MicrosoftAjax.debug.js(3.5)
2) MicrosoftAjaxWebForms.debug.js(3.5) During runtime
Its obvious that 3.5 debug files doesn't load but, 1.0.6 debug files should load without the errors displayed below.
invokeCalledTwice":"Cannot call invoke more than once.",
11"webServiceFailed":"The server method \u0027{0}\u0027 failed with the following error: {1}",
12"argumentType":"Object cannot be converted to the required type.",
13"argumentNull":"Value cannot be null.",
14"controlCantSetId":"The id property can\u0027t be set on a control.",
15"formatBadFormatSpecifier":"Format specifier was invalid.",
16"webServiceFailedNoMsg":"The server method \u0027{0}\u0027 failed.",
17"argumentDomElement":"Value must be a DOM element.",
18"invalidExecutorType":"Could not create a valid Sys.Net.WebRequestExecutor from: {0}.",
19"cannotCallBeforeResponse":"Cannot call {0} when responseAvailable is false.",
20"actualValue":"Actual value was {0}.",
21"enumInvalidValue":"\u0027{0}\u0027 is not a valid value for enum {1}.",
22"scriptLoadFailed":"The script \u0027{0}\u0027 could not be loaded.",
23"parameterCount":"Parameter count mismatch.",
24"cannotDeserializeEmptyString":"Cannot deserialize empty string.",
25"formatInvalidString":"Input string was not in a correct format.",
26"invalidTimeout":"Value must be greater than or equal to zero.",
27"cannotAbortBeforeStart":"Cannot abort when executor has not started.",
28"argument":"Value does not fall within the expected range.",
29"cannotDeserializeInvalidJson":"Cannot deserialize. The data does not correspond to valid JSON.",
30"invalidHttpVerb":"httpVerb cannot be set to an empty or null string.",
31"nullWebRequest":"Cannot call executeRequest with a null webRequest.",
32"eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler method.",
33"cannotSerializeNonFiniteNumbers":"Cannot serialize non finite numbers.",
34"argumentUndefined":"Value cannot be undefined.",
35"webServiceInvalidReturnType":"The server method \u0027{0}\u0027 returned an invalid type. Expected type: {1}",
36"servicePathNotSet":"The path to the web service has not been set.",
37"argumentTypeWithTypes":"Object of type \u0027{0}\u0027 cannot be converted to type \u0027{1}\u0027.",
38"cannotCallOnceStarted":"Cannot call {0} once started.",
39"badBaseUrl1":"Base URL does not contain ://.",
40"badBaseUrl2":"Base URL does not contain another /.",
41"badBaseUrl3":"Cannot find last / in base URL.",
42"setExecutorAfterActive":"Cannot set executor after it has become active.",
43"paramName":"Parameter name: {0}",
44"cannotCallOutsideHandler":"Cannot call {0} outside of a completed event handler.",
45"format":"One of the identified items was in an invalid format.",
46"assertFailedCaller":"Assertion Failed: {0}\r\nat {1}",
47"argumentOutOfRange":"Specified argument was out of the range of valid values.",
48"webServiceTimedOut":"The server method \u0027{0}\u0027 timed out.",
49"notImplemented":"The method or operation is not implemented.",
50"assertFailed":"Assertion Failed: {0}",
51"invalidOperation":"Operation is not valid due to the current state of the object.",
52"breakIntoDebugger":"{0}\r\n\r\nBreak into debugger?"