|
|
Thank you Luc Pattyn.
In client part, 400 folders can just be created in one second by using thread or without using it also.but server part can't retrieve all folders in such small time with all folders containing same image.So I have done that way.I dont know whether it is effective or not.but i ll try other ways also.Is there any efficient way that u can suggest me?Can anything be done in the server part?
thank u.
happy 2008.
|
|
|
|
|
|
This code snippet is a little extension to code-project's excellent article on large file transfer using Mtom and streamed mode.
Initially i have created a project in Server 2003 environment and have modified few of my server settings to make the project work.
I wanted to test my work on different environment for demonstration purpose. And i have come across many runtime exceptions and most of them being general exceptions which i also tried to search on web for a solution but could not find right solution.
I think detail description of my appconfig, webconfig, Service Contract would help to guide me better.
AppConfig
<configuration>
<system.servicemodel>
<bindings>
<basichttpbinding>
<binding name="BasicHttpBinding_IFileTransferService" maxreceivedmessagesize="10067108864">
messageEncoding="Mtom" transferMode="Streamed" />
</binding></basichttpbinding>
</bindings>
<client>
<endpoint address="http://localhost:2196/FileTransferService.svc/mex">
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransferService"
contract="Proxy.IFileTransferService" name="BasicHttpBinding_IFileTransferService" />
</endpoint></client>
</system.servicemodel>
</configuration>
Webconfig
<configuration>
<appsettings />
<connectionstrings />
<system.web>
<httpruntime maxrequestlength="65536" />
<compilation debug="true"></compilation>
<authentication mode="None" />
</system.web>
<system.servicemodel>
<bindings>
<basichttpbinding>
<binding name="FileTransferServicesBinding">
transferMode="Streamed"
messageEncoding="Mtom"
maxReceivedMessageSize="10067108864">
</binding>
</basichttpbinding>
</bindings>
<services>
<service behaviorconfiguration="MyServiceTypeBehaviors" name="WebHost.FileTransferService">
<endpoint address="mex">
binding="basicHttpBinding"
bindingConfiguration="FileTransferServicesBinding"
contract="WebHost.IFileTransferService" />
</endpoint></service>
</services>
<behaviors>
<servicebehaviors>
<behavior name="MyServiceTypeBehaviors">
<servicemetadata httpgetenabled="true" />
<servicedebug includeexceptiondetailinfaults="true" />
</behavior>
</servicebehaviors>
</behaviors>
</system.servicemodel>
</configuration>
Service Contract
using System;
using System.ServiceModel;
namespace WebHost
{
[ServiceContract]
public interface IFileTransferService
{
[OperationContract]
void UploadFile(RemoteFileInfo request);
[OperationContract]
RemoteFileInfo DownloadFile(DownloadRequest request);
}
[MessageContract]
public class DownloadRequest
{
[MessageBodyMember]
public string FileName;
}
[MessageContract]
public class RemoteFileInfo: IDisposable
{
[MessageHeader(MustUnderstand = true)]
public string FileName;
[MessageHeader(MustUnderstand = true)]
public long Length;
[MessageBodyMember(Order = 1)]
public System.IO.Stream FileByteStream;
public void Dispose()
{
if (FileByteStream!=null)
{
FileByteStream.Close();
FileByteStream = null;
}
}
}
}
The exceptions i get on chaning the environment are...
The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
stack call being
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FileTransferClient.Proxy.IFileTransferService.UploadFile(RemoteFileInfo request)
at FileTransferClient.Proxy.FileTransferServiceClient.FileTransferClient.Proxy.IFileTransferService.UploadFile(RemoteFileInfo request) in C:\Documents and Settings\pkumar\Desktop\CS\CS\FileTransferClient\Service References\Proxy\Reference.cs:line 105
at FileTransferClient.Proxy.FileTransferServiceClient.UploadFile(String FileName, Int64 Length, Stream FileByteStream) in C:\Documents and Settings\pkumar\Desktop\CS\CS\FileTransferClient\Service References\Proxy\Reference.cs:line 113
at FileTransferClient.TestForm.UploadButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\pkumar\Desktop\CS\CS\FileTransferClient\TestForm.cs:line 68
Now on changing the chunksize on the server's service method from 4096 to 2048 i get an exception
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9840000'.
and stack of errors
Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.WebRequestOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.FlushWrite()
at System.IO.BufferedStream.Flush()
at System.Xml.MimeWriter.Close()
at System.Xml.XmlMtomWriter.WriteXOPBinaryParts()
at System.Xml.XmlMtomWriter.WriteEndElement()
at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.MtomMessageEncoder.WriteMessage(Message message, Stream stream, String startInfo, String boundary, String startUri, Boolean writeMessageHeaders)
at System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(TimeSpan timeout)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FileTransferClient.Proxy.IFileTransferService.UploadFile(RemoteFileInfo request)
at FileTransferClient.Proxy.FileTransferServiceClient.FileTransferClient.Proxy.IFileTransferService.UploadFile(RemoteFileInfo request) in C:\Documents and Settings\pkumar\My Documents\Visual Studio 2008\Projects\WebHost\FileTransferClient\Service References\Proxy\Reference.cs:line 105
at FileTransferClient.Proxy.FileTransferServiceClient.UploadFile(String FileName, Int64 Length, Stream FileByteStream) in C:\Documents and Settings\pkumar\My Documents\Visual Studio 2008\Projects\WebHost\FileTransferClient\Service References\Proxy\Reference.cs:line 113
at FileTransferClient.TestForm.UploadButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\pkumar\My Documents\Visual Studio 2008\Projects\WebHost\FileTransferClient\TestForm.cs:line 68
Now changing the AppConfig binding to
<bindings>
<basichttpbinding>
<binding name="BasicHttpBinding_IFileTransferService" maxreceivedmessagesize="65536">
messageEncoding="Mtom"
transferMode="Buffered"
maxBufferSize="65536"
maxBufferPoolSize="524288"/>
</binding></basichttpbinding>
</bindings>
it works very fine but with a problem that i cant upload large files and then i realised that i have changed the maxReceivedMessageSize from 1GB to 64KB which made obvious to me.
and i change the side back to 1GB i get this exception
This factory buffers messages, so the message sizes must be in the range of an integer value.
Parameter name: bindingElement.MaxReceivedMessageSize
can anyway help me in solving my hindrances
thx in anticipation
wcf newbie
|
|
|
|
|
Can't really help, but you might want to contact the author of the article you were referring to. They might be able to shed some light.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Where MDAC is used?
Pls help me.
|
|
|
|
|
MDAC stands for Microsoft Data Access Components and is the underlying API used by the ODBC or OLEDB data access layers. This means that any of the database access you perform in .NET is going to ultimately go through MDAC.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks
I am developing a windows forms application which needs to store data locally on the client's PC.
I do not want to force the user to go through the download or installation of MDAC because I believe that it is of some 20MB in size. The setup of my application is only going to be about 1MB. How do I avoid this? Can I use some small sized embedded database? If yes, which one?
Thanks again.
|
|
|
|
|
The .NET Framework should already include the correct version of MDAC needed. For what you want to do you could use either Access or SQL Server Compact Edition (SQLCE would be my choice), but you would still need a version of MDAC.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Scott Dorman wrote: This means that any of the database access you perform in .NET is going to ultimately go through MDAC
Sorry to correct you here Scott, but if you go with a native providers such as the Sql Server providers then you end up going through the native driver.
|
|
|
|
|
Pete,
I thought you were correct on this but wanted to verify it, however what I found indicates my original statement is correct. From this link: Troubleshooting Data Access in Visual Studio .NET[^]
Getting the 'The .NET Data SQL Provider (System.Data.SqlClient) requires Microsoft Data Access Components (MDAC) version 2.6 or later' Error
The Microsoft Windows Software Development Kit (SDK) and the .NET Framework redistributable package do not include the MDAC installation. All .NET Framework applications that use data-access functionality require MDAC 2.6 or later (MDAC 2.8 SP1 is recommended). The latest version of MDAC is available as a download from the Microsoft Web site (http://www.microsoft.com).
Because Visual Studio installs MDAC by default, this error is most likely to occur when deploying to a computer that does not have Visual Studio installed.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Scott Dorman wrote: MDAC stands for Microsoft Data Access Components
Right.
Scott Dorman wrote: and is the underlying API used by the ODBC or OLEDB data access layers.
Wrong. MDAC is simply a name used for the container for various ODBC drivers and OLE DB providers. That's what the 'components' referred to are.
When you use ODBC, you're talking to the ODBC Manager. That then talks to the actual driver. In contrast when you use OLE DB your program talks directly to the Provider, but that can make use of various library facilities installed by MDAC.
Pete's correct that the SQL Server ADO.NET Provider is largely implemented in managed code - it implements the TDS protocol in managed code - but it uses the Network Library DLLs from MDAC, which is why MDAC is required. .NET Framework does not automatically install it.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks for the clarifications.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
am working on a project with the following codes:
Private Sub prono_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles prono.TextChanged
obj = objordder.getIDfrmno(CStr(prono.Text))
cmdPid.Text = Val(obj)
End Sub
where objordder.getIDfrmno is the dll and cmdPid.Text is the destinesion text box
the definetion for objordder.getIDfrmno is as follows:
public object getIDfrmno(int productno)
{
SqlConnection con = new SqlConnection(constr);
string sql = "select ProductID from tblProduct where productno=" + productno + "";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
object obj = cmd.ExecuteScalar();
con.Close();
return (obj);
}
constr is the conecction string
but not being able to get the desiered result can anyone hrlp
|
|
|
|
|
Arunava35 wrote: constr is the conecction string
What is the exact connection string you are using?
Arunava35 wrote: but not being able to get the desiered result can anyone hrlp
In what way? Is it giving you an error message? If so, what is the error message. Or is it giving you a blank screen?
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
it is not giving an error but the result which is being shown is not correct.
|
|
|
|
|
That can only mean that your query is wrong, and/or you didn't take a foreign key relation or something along those lines into consideration.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
I am enumerating through a collection where the index is a string. I would like to get my hands on that string.
I am working with regular expression named groups, but the issue is the same for any collection indexed with strings.
An example:
Regex regEx = new Regex(@"^(?<name>\w+):(?<value>\w+)");<br />
Match match = regEx.Match("abc:123");<br />
GroupCollection groups = match.Groups;<br />
<br />
Console.WriteLine(groups["name"]);<br />
Console.WriteLine(groups["value"]);
(Note that the sad face emoticon in the first line should be a colon followed by a left parenthesis. I could not turn this off.)
The above writes the following to the Console:
abc
123
I would like to also write the index so the output looks like:
name = abc
value = 123
Ideally, I would like to use a foreach to print all indexes and values in the collection. This would look something like:
foreach (Group group in match.Groups)<br />
{<br />
Console.WriteLine(??? + " = " + group.Value);<br />
}
I cannot figure out what "???" should be.
Thanks.
|
|
|
|
|
I looked into this and no real solution. Have you found a way to do this?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
No, I have not found a solution.
I suspect it is buried in the container classes or iterators some place, but I haven't had time to look.
It wasn't a high-priority issue for me, so I am currently doing without.
|
|
|
|
|
kalkwarf wrote: I suspect it is buried in the container classes or iterators some place
I would think so. For fun I am going to dig around at this and let you know if I run across anything
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
So for the last 11 years or so I've been working to push as much of the query work in the database. So you build an objet that calls a stored proc the gives you the data that you are looking for. So now linq comes out which seems to fly in the face of that. I'm watching some of the videos on msdn and she is doing a bunch of stuff that should really be done in the database.
Am I wrong? I see some uses for link. I like the DAL but I think when you get to using join's in link you have gone too far.
|
|
|
|
|
So you see what happens when you watch too many MS videos. You start all your sentances with "So".
|
|
|
|
|
lol
|
|
|
|
|
Personally I'm with you, I've always put as much of the data querying and data processing on to the DB as possible (where appropriate of course) because the DB is designed for such thing and is very efficient at handling large data sets.
Linq works on the current trend (.Net included) of making performance trade offs in return for ease of use in the form of productivity and maintainability.
I haven't had a chance to get to grips with Linq yet and really use it in anger so it'll be interesting to find out if it's suitable to use instead of stored procs.
One thing to remember is that Linq is about more than just databases, it allows you to do this querying with XML and even objects/collections which Stored Procs arn't so good at handling
|
|
|
|
|