[Mono-dev] WCF in Mono 2.6.7

joelcaner joelcaner at gmail.com
Mon Jan 17 11:04:36 EST 2011


I think that the error: Bad request is because  I need to configure
the XmlDictionaryReaderQuotas.
Can you tell me how you do that in Mono?

By the way, I upgraded to Mono 2.8.

Cheers,

On Mon, Jan 17, 2011 at 2:17 AM, Atsushi Eno-2 [via Mono] <
ml-node+3220791-556167135-208427 at n4.nabble.com<ml-node%2B3220791-556167135-208427 at n4.nabble.com>
> wrote:

> You might want to read this:
>
> http://nirajrules.wordpress.com/2009/08/03/mtom-vs-streaming-vs-compression-%E2%80%93-large-attachments-over-wcf/
>
> Atsushi Eno
>
> (2011/01/15 22:19), Joel Caner wrote:
>
> > Thank you for your reply. Can you tell me if there is another way to send
>
> > large data/file then?..can you provide an example of a client and
> service?
> >
> > Thank you again for your time.
> >
> > Cheers,
> >
> > -----Original Message-----
> > From: Atsushi Eno [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3220791&i=0>]
>
> > Sent: Saturday, January 15, 2011 3:11 AM
> > To: joelcaner
> > Cc: [hidden email]<http://user/SendEmail.jtp?type=node&node=3220791&i=1>
> > Subject: Re: [Mono-dev] WCF in Mono 2.6.7
> >
> > Not sure where the actual error occurs without stack trace, but 2.6 is
> > too old
> > for WCF to try anyways.
> > And Mtom is almost untested so it will cause any kind of problem (never
> > expected that there are actually people who use it).
> >
> > Atsushi Eno
> >
> > (2011/01/14 23:37), joelcaner wrote:
> >> I am having trouble getting WCF working on Mono in Suse Linux 11.3
> >> I have the client as follow:
> >> BasicHttpBinding binding = new BasicHttpBinding();
> >>               binding.Security.Mode = BasicHttpSecurityMode.None;
> >>               binding.TransferMode = TransferMode.Streamed;
> >>               binding.MessageEncoding = WSMessageEncoding.Mtom;
> >>               binding.MaxReceivedMessageSize = int.MaxValue;
> >>
> >>               EndpointAddress address = new
> >> EndpointAddress("http://localhost:5800/DataUploader");
> >>               ChannelFactory<IDataUploader>   channel = new
> >> ChannelFactory<IDataUploader>(binding, address);
> >>
> >>               IDataUploader uploader = channel.CreateChannel();
> >>
> >>               try
> >>               {
> >>
> >>
> >>                   uploader.Upload(File.Open(@"G:\anthem-1.5.2.zip",
> >> FileMode.Open, FileAccess.Read));
> >>                   Console.WriteLine("File uploaded to the server");
> >>                   Console.ReadLine();
> >>               }
> >>               catch (Exception ex)
> >>               {
> >>                   Console.Write(ex.Message);
> >>                   Console.ReadLine();
> >>               }
> >>               finally
> >>               {
> >>                   ((IClientChannel)uploader).Close();
> >>
> >>
> >>               }
> >>
> >> I have the following interface:
> >> [ServiceContract]
> >>       interface IDataUploader
> >>       {
> >>           [OperationContract]
> >>           void Upload(Stream data);
> >>       }
> >>
> >> Now the service is as follow on DataUploader.cs:
> >> class DataUploader : IDataUploader
> >>
> >>       {
> >>
> >>           #region IDataUploader Members
> >>
> >>           public void Upload(Stream data)
> >>
> >>           {
> >>
> >>               string xmlFile = @"c:\temp\uploadedfile" + ".zip";
> >>
> >>
> >>
> >>               using (FileStream fs = new FileStream(xmlFile,
> > FileMode.Create))
> >>               {
> >>
> >>                   int bufferSize = 1 * 1024 * 1024; // 1MB buffer
> >>
> >>                   byte[] buffer = new byte[bufferSize];
> >>
> >>                   int bytes;
> >>
> >>
> >>
> >>                   while ((bytes = data.Read(buffer, 0, bufferSize))>
> 0)
> >>
> >>                   {
> >>
> >>                       fs.Write(buffer, 0, bytes);
> >>
> >>                       fs.Flush();
> >>
> >>                   }
> >>
> >>               }
> >>
> >>
> >>
> >>
> >>
> >>           }
> >>
> >>            #endregion
> >>
> >>
> >>
> >>
> >>
> >>       }
> >>
> >> Now on IDataUploader.cs:
> >> [ServiceContract]
> >>
> >>       interface IDataUploader
> >>
> >>       {
> >>
> >>           [OperationContract]
> >>
> >>           void Upload(Stream data);
> >>
> >>       }
> >>
> >> On the main.cs I have:
> >> public static void Main (string[] args)
> >>
> >> {
> >>
> >> ServiceHost host = new
> > ServiceHost(typeof(DataUploader));
> >>
> >>
> >>               BasicHttpBinding binding = new BasicHttpBinding();
> >>
> >> binding.Security.Mode = BasicHttpSecurityMode.None;
> >>
> >>               binding.TransferMode = TransferMode.Streamed;
> >>
> >> binding.MessageEncoding = WSMessageEncoding.Mtom;
> >>
> >>               binding.MaxReceivedMessageSize = int.MaxValue;
> >>
> >>
> >>
> >>
> >>
> >>               host.AddServiceEndpoint(typeof(IDataUploader), binding,
> new
> >> Uri("http://localhost:5800/DataUploader"));
> >>
> >>
> >>
> >>               ServiceBehaviorAttribute attribute =
> >>
> >
> (ServiceBehaviorAttribute)host.Description.Behaviors[typeof(ServiceBehaviorA
>
> > ttribute)];
> >>               attribute.ConcurrencyMode = ConcurrencyMode.Multiple;
> >>
> >>               attribute.InstanceContextMode =
> InstanceContextMode.Single;
> >>
> >> attribute.IncludeExceptionDetailInFaults = true;
> >>
> >>
> >>
> >>               ServiceThrottlingBehavior throttling = new
> >> ServiceThrottlingBehavior();
> >>
> >>               throttling.MaxConcurrentSessions = 24;
> >>
> >>               throttling.MaxConcurrentCalls = 24;
> >>
> >>
> >>
> >>               host.Description.Behaviors.Add(throttling);
> >>
> >>
> >>
> >>               host.Open();
> >>
> >>
> >>
> >>               Console.WriteLine("Service Hosted ...");
> >>
> >>               Console.ReadKey();
> >>
> >>               host.Close();
> >>
> >> }
> >> I have both client and service running on the same system. I get an
> error:
> >> Object reference not set to an instance of an object error. When I run a
>
> >> client on a windows system and the service on the linux system I get
> "bad
> >> request(400) error. Can someone help me understand what I am missing?
> >
> >
>
> _______________________________________________
> Mono-devel-list mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=3220791&i=2>
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
> ------------------------------
>  View message @
> http://mono.1490590.n4.nabble.com/WCF-in-Mono-2-6-7-tp3217763p3220791.html
> To unsubscribe from WCF in Mono 2.6.7, click here<http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3217763&code=am9lbGNhbmVyQGdtYWlsLmNvbXwzMjE3NzYzfC0xNzczOTczNjM4>.
>
>

-- 
View this message in context: http://mono.1490590.n4.nabble.com/WCF-in-Mono-2-6-7-tp3217763p3221227.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110117/07cc0c62/attachment-0001.html 


More information about the Mono-devel-list mailing list