Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are running .NET 2.0 ASMX web services on Windows 2003 server on IIS 6.0. We have migrated a legacy VB 6.0 application to .NET 2.0 application using VB.NET. CDATE function is used at many places and we did not replace that with .NET equivalent date functions.

After migration, code was working fine for many years.

Recently, we have started encountering issues on our production servers where the below code fails:

CDATE("11 Jul 2011 21:10:27")

Error: Conversion from string "11 Jul 2011 21:10:27" to type 'Date' is not valid.

If we perform an iisreset, the same code starts working fine.

Could this be due to some recent patch for Windows server/ .NET patch? Please help us to resolve this issue.

share|improve this question
    
How long after a reset before it starts to fail again? A particular time of day, perhaps? –  Joel Coel Jan 18 '12 at 17:38
    
And this is a bit pedantic, but in VB.Net, CDate() is no longer defined as a function. It is now an operator. –  Joel Coel Jan 18 '12 at 17:39

2 Answers 2

General advice: Don't use IISReset. Recycle only the application pool with the problem.

This won't fix the issue but will cause less downtime when restoring service.

share|improve this answer

I might be wrong, but I suspect that it works for SOME dates and not for others.

In order to recognize and process a date, the CDate function derives the ideal date format from the systems locale settings. Check the regional settings on the server and make sure that your input format matches a system date format.

Ideally, fix this programmatically, by getting a datetime format from the IFormatProvider interface: http://msdn.microsoft.com/en-us/library/9xk1h71t.aspx

share|improve this answer
    
See also SetVarConversionLocaleSetting if it seems to change when someone logs on/off to the server. support.microsoft.com/kb/306044 (and related links) - think this still applies today. Programmatic solution is best; pragmatic solution may win anyway :) –  TristanK Jan 18 '12 at 23:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.