Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / January 2006

Tip: Looking for answers? Try searching our database.

The surrogate pair is invalid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bike - 05 Jan 2006 09:23 GMT
Greetings,

I have an application with several web services. They all connect to an
Oracle database to retreive/save data. Some methods return datasets
containning English and/or Arabic data. All these methods work fine most of
the time, but sometimes I receive the following error:

Server was unable to process request. --> There was an error generating the
XML document. --> The surrogate pair is invalid.

I cannot reproduce the error, but I think it happens only when the dataset
is being serialized to XML before being sent to the client.

When this exception is thrown after calling a certain web method, it is only
resolved by restarting the application domain in which the web services are
running. I restart the application domain by making any change in the
web.config file (such as adding/removing a space at the end of the file).
After restarting the application domain, the problem is solved, even though
I call the same web method with the same parameters and against the same
database (I just refresh the web page that calls the web method and it
works)

Thanks for your help in advance
Bike - 05 Jan 2006 09:30 GMT
Sorry I forgot to mention that I am using .NET Framework version 1.1 service
pack 1. The problem happens on both Windows 2000 Server and Windows Server
2003 machines.

> Greetings,
>
[quoted text clipped - 19 lines]
>
> Thanks for your help in advance
CG - 09 Jan 2006 01:21 GMT
Do you have session enabled?

I have seen problem where session is enabled and we get wiered error messages

> Sorry I forgot to mention that I am using .NET Framework version 1.1 service
> pack 1. The problem happens on both Windows 2000 Server and Windows Server
[quoted text clipped - 28 lines]
> >
> > Thanks for your help in advance
Raj - 31 Jan 2006 22:21 GMT
I found your post when I was encountering the same problem. And did not see a resolution for it.

Here is what happened to me.

After days of scouring multiples times through every field/object that was being sierielized, I finally found one that had some very unusual data.  And there was a lot of it, it almost looked like what I used to see in old C code for an unterminated string. Of course I have been told that that is impossible for .Net code, it still looked that way to me.

Anyway the field in question was being populated by a call to the database for a single date field from a table. I am using an Oracle 8i db, the select was "SELECT TO_CHAR(MAX(DB_DATE_FIELD), 'YYYYMMDDHH24MISS') AS VAL FROM TABLE_OF_DATES".  The tricky part was that it did not always return the "garbage", somtimes it was a NULL, sometimes it was real data. I tried the SQL repeatedly outside of the program, sqlplus, and every time it returned me the maximum date.

I played around with the select inside the program and found that the table had null values in some of the rows for the date. This should not have mattered but I was at my wits end, so added "WHERE DB_DATE_FIELD IS NOT NULL" to the SQL and TA DA !!! I got a good value.  I have been watching it now for the past 2 days and so far so good.

My suggestion to you is to create a method thats dumps the object you are serializing to a debug/log file that you can easily access. Also put a try...catch around your serialize method so you can match up the dumped object with the attempt to serialize. At least that way you know what data is being processed when the error occurs. After a few tiems a pattern my show up.

I hope this helps you in some way. If you found a differnt cause or solution please post back.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.