C# - XElement.ToString() Causes System.OutOfMemoryException?

Nov 25, 2010

I have an XElement object that contains about 120MB of data. The XML consists of approx 6000 elements of about 20kb each.

I am trying to call XElement.ToString() as I need to return the OuterXml in a webservice.

I am getting a System.OutOfMemoryException.

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown:

at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
at System.Text.StringBuilder.Append(Char[] value, Int32 startIndex, Int32 charCount)
at System.IO.StringWriter.Write(Char[] buffer, Int32 index, Int32 count)
at System.Xml.XmlEncodedRawTextWriter.FlushBuffer()
at System.Xml.XmlEncodedRawTextWriter.WriteAttributeTextBlock(Char* pSrc, Char* pSrcEnd)
at System.Xml.XmlEncodedRawTextWriter.WriteString(String text)
at System.Xml.XmlEncodedRawTextWriterIndent.WriteString(String text)
at System.Xml.XmlWellFormedWriter.WriteString(String text)
at System.Xml.XmlWriter.WriteAttributeString(String prefix, String localName, String ns, String value)
at System.Xml.Linq.ElementWriter.WriteStartElement(XElement e)
at System.Xml.Linq.ElementWriter.WriteElement(XElement e)
at System.Xml.Linq.XElement.WriteTo(XmlWriter writer)
at System.Xml.Linq.XNode.GetXmlString(SaveOptions o)
at System.Xml.Linq.XNode.ToString()

I have the same data in an XmlDocument and can call XmlDocument.OuterXml without a problem. I can also call XElement.Save() to save the XML to a file without a problem.

View 2 Replies


Similar Messages:

Web Forms :: Theme / Error1 'XElement'is Ambiguous In The Namespace 'System.Xml.Linq'.InternalXmlHelper.vb?

Jan 3, 2010

i am facing a problem in theme and skin.

when i am trying this in skin

<asp:TextBox runat="server" BackColor="#BFDFFF" BorderColor="Black"></asp:TextBox>
<asp:DropDownList runat="server" BackColor="#BFDFFF"> </asp:DropDownList>
<asp:Button runat="server" BackColor="#BFDFFF" BorderColor="Black" />
<asp:GridView runat="server" AllowPaging="True"
AutoGenerateColumns="False" Width="100%">
<RowStyle BackColor="#BFDFFF" ForeColor="Black" />
<SelectedRowStyle BackColor="#FFFF99" />
<HeaderStyle BackColor="#666666" />
<AlternatingRowStyle BackColor="Silver" />
</asp:GridView>
<asp:DataList runat="server" Width="100%" RepeatColumns="3">
<ItemStyle BackColor="#BFDFFF" ForeColor="Black" Width="90%" />
<AlternatingItemStyle BackColor="Silver" />
<HeaderStyle BackColor="#666666" />
</asp:DataList>

and < pages theme="BlueTheme" runat="Server"/>

then this error comes .

Error1 'XElement'is ambiguous in the namespace 'System.Xml.Linq'.InternalXmlHelper.vb

View 7 Replies

System.OutOfMemoryException -why Message Is Coming

Sep 6, 2010

Does anyone know why this happens?

[URL]

It was running fine and then all of a sudden this message poped up.

View 2 Replies

C# - System.outofmemoryexception When Filling DataAdapter?

Feb 23, 2011

I have to pull 150K records from DB. I am using da.Fill(ds,"Query") and its throwing system.outofmemoryexception.

Dim daGrid As New SqlDataAdapter(sqlcmd_q)
daGrid.Fill(dsGrid, "Query")
daGrid.Dispose()

I need this datatable only. I cannot use XML. because I need assign this to MSChartControl to display ScotterPlot.

View 2 Replies

Iis - Getting System.OutOfMemoryException Due To Temp Folder?

Feb 17, 2010

I have hosted some 5 applications on IIS in my server.

After sometimes I am getting System.OutOfMemoryException error due to out of memory in ASP.NET Temp Folder.

Is there any way to clear it automatically or any setting for this.

View 3 Replies

System.OutOfMemoryException Being Thrown / How To Fix This Exception

Jun 22, 2010

I am getting a system.outofmemory exception in my code:

[code]....

how I go about diagnosing and fixing this exception?

View 2 Replies

System.OutOfMemoryException: Out Of Memory Error / How To Solve It

Jun 1, 2010

I just published my website to a server. Using this server I get the following error when I click on an image to view it:

System.OutOfMemoryException: Out of memory.

I didn't had the error when I worked on my local server.

View 4 Replies

Export To Excel : Getting Error / System.OutOfMemoryException

Jul 9, 2010

I am facing a problem wherein, whenever I am trying to export a large recordset to excel (over 50k records) I am getting the System.OutOfMemoryException. I want to know a couple of things :

1. How do I handle this exception as try - catch does not seem to work?

2. I am pasting sample code. I just want to know if there is a better way of doing this :

[code]....

View 5 Replies

ADO.NET :: System.OutOfMemoryException With Entity Framework When Refresh

Nov 15, 2010

When I refresh the entity framework with big table, I get the System.OutOfMemoryException.

Is there any better way to refresh the EF with big tables? I'm using .Net 3.5

View 5 Replies

Configuration :: System.OutOfMemoryException In Shared Web Host?

Oct 14, 2010

I have a website that I have run for years running a custom built CMS. It has had no problems ever. I decided to create a demo (temporary url) of the CMS using the exact same website. Only people I give access to would be able to login and change it, so it basically is not in use for the most part.

I tried this demo site the past few days, and I noticed that I kept getting System.OutOfMemoryException errors. I would wait for an hour or so, then it would work. Next day, same thing.

What could explain this? 2 exact same websites....one that is used all the time (no memory issues), and one that is hardly ever used (memory issues). Doesn't really make sense to me.

View 6 Replies

When Exporting Getting Error / System.OutOfMemoryException Was Unhandled

Sep 20, 2010

I stuck in the issue of exporting excel it gives error System.OutOfMemoryException in excel 2007 we cam export 1000000 rows but while exporting more then 250000 rows its gives the error the logic to upload the excel as i am using is

[code]....

View 1 Replies

Configuration :: Exception Of Type 'System.OutOfMemoryException'?

Aug 3, 2010

We have an asp.net 2.0 application in which we get the exception of type 'System.OutOfMemoryException' whenever value is retrieved or stored in viewstate. It does not happen when we test it in local PC but when it is deployed on application server, the exception is thrown.

View 2 Replies

Web Forms :: Exception Of Type 'System.OutOfMemoryException' Was Thrown?

Feb 8, 2010

I have one issue , on that page i have Gridview ie: binding data(by making relationship b/w two tables ) ie: each row contains 75 EasyListbox control so it will be visible as per the condition ie: getting from Database.

But when the page_Loads on that page - First rows shows correctly ie: when i click on paging for Second page - it shows error like this

[code]....

View 13 Replies

Configuration :: Exception Of Type 'System.OutOfMemoryException' Was Thrown?

Jan 20, 2011

I am getting Error Msg Given Below..After Uploading My WebApplication..whenever i try to access my webapplication? what is the exactly reason of this Error. Some time it solved automatically when i try some time later.

Server Error in '/' Application.

Exception of type 'System.OutOfMemoryException' was thrown.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

View 1 Replies

Web Forms :: File Upload And Get System.OutOfMemoryException Error

Feb 22, 2010

i have a file upload control in my page and have set the max file size in web.config to 1 GB (this is an intranet app).

However, when I try to upload a 280 MB file, it throws System.OutOfMemoryException. The server has 4 GB of RAM and plenty of disk space.

View 4 Replies

Getting Error / Exception Of Type 'System.OutOfMemoryException' Was Thrown

Apr 8, 2010

I have an ashx handler with the following code. The idea is to hide the path of the file and prompt a download

[code]....

This works fine for some files however on others i get

Exception of type 'System.OutOfMemoryException' was thrown.

View 2 Replies

WCF / ASMX :: Exception Of Type 'System.OutOfMemoryException' Was Thrown

Nov 30, 2010

I am getting this exception whenever i tried to delete the WCF Service reference in project.I cannot even update it.Our WCF Service is bit huge and looks like this is causing the issue.I Start/Stopped IIS web server but still i cant get rid of it.

View 1 Replies

DataSource Controls :: System.OutOfMemoryException - Cannot Execute Script / How To Fix Error

Apr 1, 2010

I am trying to run a script to build a database structure for open source app nopcommerce. When I try to run the script via sql management studio I receive and error (below). I am running sql express on the hosting server. I also have issues connecting via management studio directly to the sql server installation, but am able to connect via remote desktop. I dont know specifics about the installation since I was not the one to install it.

View 1 Replies

NHibernate StructureMap Webform System.OutOfMemoryException Error - How To Rectify

Jan 15, 2011

i created a web application by using Asp.NET webform, NHibernate to access Sql Server 2008 database and StructureMap as IOC Container.

Everything seem to work ok since few users use it; when user number increases (we can say 10+ users) webapp crashes with this error:

System.OutOfMemoryException

I downloaded redgate ants suite: the performance tool says that maximum cpu time is in NHibernate createSessionFactory for a GetAll request.

This is my NHibernateHelper object:

[code]....

View 2 Replies

C# - Get InnerText From XElement?

Mar 19, 2011

I have an XML file I need to parse, but only for the text, not the HTML. Here's an example of a node:

<highlights><![CDATA[<ul style="color:#000000;font-size:small;font-family:verdana,geneva,sans-serif"><li>Classy & elegant purse hooks</li><li>Choose from various styles<br></li><li>Stable and reliable</li><li>Makes a great gift! </li></ul> ]]></highlights>

As you can see, the CDATA has HTML code in it, so when I do element.Value I also get the tags. Is there any simple way to get just the text?

View 2 Replies

C# - What Is The Difference Between Xxx.tostring() And (string)xxx

Jan 24, 2011

whats the difference in the two string methods below?

string str1 = dr["RAGStatusCID"].ToString();
string str2 = (string)dr["Description"];

View 7 Replies

How To Format DateTime.ToString

Feb 5, 2010

How to format DateTime.ToString(????)Result should look like: 2010-02-05T10:36:26+10:00

View 2 Replies

C# - ToString() Format Is Not Working?

Nov 29, 2010

I've a strange problem. We use Dutch and French lanuage on our site (nl-NL / fr-FR)I'm binding to a gridview and the strange thing is, the numeric value-saparator (dot) is not displaying well for French (fr-FR)ASP.NET

protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lbla_min_10 = new Label();

[code]...

View 4 Replies

Web Forms :: Datetime.now.tostring() Two Different Time

Nov 11, 2010

I have deployed my asp.net application in my hosting provider they are from US... I have one filed in which i have wriiten Datetime.now.tostring() it saves in Database table it save 11/11/2010 5:20:47 AM

View 17 Replies

Security :: MembershipUser.ProviderUserKey.ToString?

Mar 20, 2011

When I run the following debugging code it writes out credits:0

Dim MembershipUser As MembershipUser = Membership.GetUser()
Dim UID As String = MembershipUser.ProviderUserKey.ToString
SQL = "SELECT SUM(Credits) As Credits FROM Credits WHERE " & _
"DateDiff(m, [DateTime], GETDATE()) < 6 AND [UserID]=@UserID;"
cmd = New SqlCommand(SQL, Conn)
cmd.Parameters.Add(New SqlParameter("@UserID", UID))
DataReader = cmd.ExecuteReader()
If DataReader.HasRows Then
Do While DataReader.Read

[Code]....

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved