![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a Web Service that returns very large string object. The string contais xmldata fetched directly from sql server by using xml explicit. The thing here is that if I get xml-document that is 11mb without web service it takes about 2 minutes. With web service it takes about 5min. This is acceptable. But when I get 37mb document without web service it takes about 5-6min but with web service it takes about 50min! As you can see this doesn't quite match up... The calls are excactly the same, so the problem isn't there. On the bigger document sqlserver does a little more work, but still (according to task manager) it's the web service that takes 80-90% of the time. The call is like this: Dim ws As New webservice ws.Timeout = System.Threading.Timeout.Infinite str = ws.getData Dim sw As StreamWriter = New StreamWriter("c:\Temp\data.xml", False) sw.Write(str) sw.Close() and the web service is like this: Dim conn As New SqlConnection(connstr) Dim sqlcom As New SqlCommand Dim sqlre As SqlDataReader sqlcom.CommandType = CommandType.StoredProcedure sqlcom.Connection = conn sqlcom.CommandTimeout = 1200 sqlcom.CommandText = "getData" conn.Open() sqlre = sqlcom.ExecuteReader(CommandBehavior.CloseConnecti on) While sqlre.Read str = str & sqlre(0) End While --then close and return str I've also tried it like this: Private connec As ADODB.Connection Private comm As New ADODB.Command XmlIgnore()> Private objStream As New ADODB.Stream XmlIgnore()> Public str As String ------ connec = Me.GetConnection() comm.CommandType = CommandType.StoredProcedure comm.CommandTimeout = 1200 comm.ActiveConnection = connec comm.CommandText = "getData" objStream.Open() comm.Properties("Output Stream").Value = objStream objStream.Position = 0 comm.Execute(, , 1024) str = objStream.ReadText --then close and return str but it's the same with this way too. Webmethod also has the "BufferResponse:=False" set. The return object could be xmldocument also, but if I've understood correctly returning string is better and then construct the xmldocument on client-side. The webservice is on localhost. Does anyone have any ideas why it's taking so long and maybe how it could be fixed? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Thanks for the answer Pandurang. Isn't there really anything I can do about this? Maybe I could get the data in chunks, but since Biztalk and several other instances are included, it would be quite time consuming to build the solution... Any ideas? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |