Click here to Skip to main content
15,923,015 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: How to copy a reference type ? Pin
Urs Enzler7-Jan-08 3:08
Urs Enzler7-Jan-08 3:08 
GeneralThreading in c# Pin
Prabhat0036-Jan-08 17:36
Prabhat0036-Jan-08 17:36 
GeneralRe: Threading in c# Pin
Steppo7-Jan-08 0:52
Steppo7-Jan-08 0:52 
GeneralRe: Threading in c# Pin
Prabhat0037-Jan-08 17:42
Prabhat0037-Jan-08 17:42 
GeneralRe: Threading in c# Pin
Luc Pattyn7-Jan-08 18:04
sitebuilderLuc Pattyn7-Jan-08 18:04 
GeneralRe: Threading in c# Pin
Prabhat0037-Jan-08 18:37
Prabhat0037-Jan-08 18:37 
GeneralRe: Threading in c# Pin
Luc Pattyn8-Jan-08 1:58
sitebuilderLuc Pattyn8-Jan-08 1:58 
GeneralProblem in uploading files using Mtom, Streamed transfered Pin
PavanPT5-Jan-08 14:29
PavanPT5-Jan-08 14:29 
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" /&gt;
</binding></basichttpbinding>
</bindings>
<client>
<endpoint address="http://localhost:2196/FileTransferService.svc/mex">
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransferService"
contract="Proxy.IFileTransferService" name="BasicHttpBinding_IFileTransferService" /&gt;
</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"&gt;
</binding>
</basichttpbinding>
</bindings>
<services>
<service behaviorconfiguration="MyServiceTypeBehaviors" name="WebHost.FileTransferService">
<endpoint address="mex">
binding="basicHttpBinding"
bindingConfiguration="FileTransferServicesBinding"
contract="WebHost.IFileTransferService" /&gt;
</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"/&gt;
</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 Smile | :)
GeneralRe: Problem in uploading files using Mtom, Streamed transfered Pin
Paul Conrad6-Jan-08 10:10
professionalPaul Conrad6-Jan-08 10:10 
GeneralMDAC Pin
agauravgr84-Jan-08 23:57
agauravgr84-Jan-08 23:57 
GeneralRe: MDAC Pin
Scott Dorman5-Jan-08 3:34
professionalScott Dorman5-Jan-08 3:34 
QuestionRe: MDAC Pin
agauravgr85-Jan-08 3:41
agauravgr85-Jan-08 3:41 
GeneralRe: MDAC Pin
Scott Dorman5-Jan-08 3:59
professionalScott Dorman5-Jan-08 3:59 
GeneralRe: MDAC Pin
Pete O'Hanlon5-Jan-08 9:43
mvePete O'Hanlon5-Jan-08 9:43 
GeneralRe: MDAC Pin
Scott Dorman6-Jan-08 5:16
professionalScott Dorman6-Jan-08 5:16 
GeneralRe: MDAC Pin
Mike Dimmick6-Jan-08 7:46
Mike Dimmick6-Jan-08 7:46 
GeneralRe: MDAC Pin
Scott Dorman6-Jan-08 7:50
professionalScott Dorman6-Jan-08 7:50 
QuestionHelp Needed Pin
Arunava354-Jan-08 18:52
Arunava354-Jan-08 18:52 
GeneralRe: Help Needed Pin
DigiOz Multimedia5-Jan-08 8:51
DigiOz Multimedia5-Jan-08 8:51 
GeneralRe: Help Needed Pin
Arunava355-Jan-08 16:56
Arunava355-Jan-08 16:56 
GeneralRe: Help Needed Pin
DigiOz Multimedia6-Jan-08 2:32
DigiOz Multimedia6-Jan-08 2:32 
QuestionString index Pin
kalkwarf4-Jan-08 9:38
kalkwarf4-Jan-08 9:38 
GeneralRe: String index Pin
Paul Conrad26-Jan-08 7:23
professionalPaul Conrad26-Jan-08 7:23 
GeneralRe: String index Pin
kalkwarf28-Jan-08 2:59
kalkwarf28-Jan-08 2:59 
GeneralRe: String index Pin
Paul Conrad28-Jan-08 13:53
professionalPaul Conrad28-Jan-08 13:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.