Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
1

1eyhk1

@1eyhk1
About
Posts
20
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Recommendation for FTP/SFTP/FTPS component in C#?
    1 1eyhk1

    Recommendation for FTP/SFTP/FTPS component in C#? Commercial/Open Source both good, any suggestion guys?

    C# csharp question

  • OutOfMemoryException - Managed Console hosted WCF [modified]
    1 1eyhk1

    hello Is WCF Message Chunking only avail for .NET 4 and not for wsDualHttpBinding? http://msdn.microsoft.com/en-us/library/aa717050.aspx[^] I got a feeling only way to get around this is to implementing chunking and session management yourself. Thanks

    WCF and WF csharp wcf help dotnet visual-studio

  • OutOfMemoryException - Managed Console hosted WCF [modified]
    1 1eyhk1

    Guys any idea? thank you

    WCF and WF csharp wcf help dotnet visual-studio

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    hey yes, many thanks, working now and I just dodged a tight deadline! (Code I posted actually works, forgot to remove "Bummer" as initially when I posted the reply I was still having problem) Thanks very much!

    C# tutorial question learning

  • WCF ecscpe character
    1 1eyhk1

    resolved! I embed objects as byte[] wrapped inside xml MyLib.Xxx ... serialized byte[] goes here Initially, byte[] goes under was formatted using Encoding.ACSII.GetString This screws up because of funny character. All is fine after replacing Encoding.ASCII.GetString with Convert.To/FromBase64String()

    WCF and WF csharp wcf com lounge

  • OutOfMemoryException - Managed Console hosted WCF [modified]
    1 1eyhk1

    There's no MaxBufferSize for wsDualHttpBinding - it's for wsHttpBinding I've configured maxBufferPoolSize to Int32.MaxValue (2,147,483,647 - that's 2GB) I think our app max ~125MB (far below 2GB), I really have no clue what can be done with wsDualHttpBinding (we need dual for callback)

    WCF and WF csharp wcf help dotnet visual-studio

  • WCF ecscpe character
    1 1eyhk1

    hello I'm in process of wiring down many object hierarchy developed by other guys in my firm - some are quite large and I intend to convert them to byte[] and then compress via System.IO.Compression[^]. But after compression WCF seems to have screwed up due to special escape characters. I Googled but cannot find any documentation - I need to have the exact list of escape characters but not sure why it's so difficult to find. Thanks http://social.msdn.microsoft.com/Forums/en/adodotnetdataservices/thread/9559c893-aac1-438b-b71e-c132d09c0f86[^]

    WCF and WF csharp wcf com lounge

  • OutOfMemoryException - Managed Console hosted WCF [modified]
    1 1eyhk1

    hello There's an InsufficientMemoryException which I failed to resolve - binding config as follows: <bindings> <wsDualHttpBinding> <binding name="MyBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="500000000" maxReceivedMessageSize="500000000" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="500000000" maxArrayLength="500000000" maxBytesPerRead="500000000" maxNameTableCharCount="500000000" /> </binding> </wsDualHttpBinding> </bindings> <services> <!-- This section is optional with the new configuration model introduced in .NET Framework 4. --> <service name="MyLib.MyService" behaviorConfiguration="MyBinding"> <host> <baseAddresses> <add baseAddress="http://localhost:12345/MyServiceWCF/MyService"/> </baseAddresses> </host> <endpoint address="MyService" binding="wsDualHttpBinding" bindingConfiguration="MyBinding" contract="MyLib.IMyService" /> ... And error message: Ex {"Failed to allocate a managed memory buffer of 67108864 bytes. The amount of available memory may be low."} System.Exception {System.InsufficientMemoryException} But as seen above, maxBufferPoolSize="500000000" > 67,108,864 (Also, maxBufferPoolSize = int32 = max 2,147,483,647 - that's 2GB, should be much more than required) - it's not making sense when allocated mem 67MB throws an exception when it's lower than configured limit. I'm baffled (and not sure what to do as Dual don't support Streaming) Help? Dual don't support streaming... (binding attrib "transferMode" don't apply)[^] Windows 2003 process memory limit (not hit, should not be the root cause)[^] WCF default Read Quota[

    WCF and WF csharp wcf help dotnet visual-studio

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    Oh bummer {"Type 'XXXXX.MyAccount' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed."} I suspect this is because MyAccount is actually a complex hierarchy containing a child collection... class MyAccount { ... public List&lt;Invoicesgt; GroupList; } Eekkk... I was going to wire down an array of accounts (i.e. MyAccount[]) but now can't even wire down one single MyAccount... I desparation I tried this: using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, result); byte[] BinAcct = stream.ToArray()); } But even then I ran into runtime exception, complaint was that class is not marked serializable (Although marked DataContract), looks like I got lucky with DataContractSerializer dataContractSerializer = new DataContractSerializer(Acct.GetType()); using (MemoryStream memoryStream = new MemoryStream()) { dataContractSerializer.WriteObject(memoryStream, Acct); btAccountSet = new byte[memoryStream.Length]; Array.Copy(memoryStream.GetBuffer(), btAccountSet, btAccountSet.Length); } This finally get the job done (only serialization part, still stuck during deserialization). 1. Serialize side: DataContractSerializer serial = new DataContractSerializer(Acct.GetType()); using (MemoryStream memoryStream = new MemoryStream()) { serial.WriteObject(memoryStream, oAcct); btPayload = new byte[memoryStream.Length]; Array.Copy(memoryStream.GetBuffer(), btPayload, btPayload.Length); } 2. Deserialize side: byte[] raw = (byte[]) GetPayload(); serial = new DataContractSerializer(typeof(MyAccount)); using (MemoryStream memoryStream = new MemoryStream(raw)) { memoryStream.Seek(0, SeekOrigin.Begin); oAcct = (MyAccount) serial.ReadObject(memoryStream); } So, all good sending a single object, but still need to attempt sending/serializing a list of MyAccount (with subclasses) Thanks

    modified on Saturday, August 21, 2010 1:46 AM

    C# tutorial question learning

  • How can I convert a Class to byte[] then back to Class for Windows Mobile? [modified]
    1 1eyhk1

    hello How did you manage?

    Mobile question help sysadmin data-structures security

  • WCF InvalidCastException - "from in the context ['Default' | 'LoadFrom'] at location"
    1 1eyhk1

    hello - any idea on this sort of exception? + [System.InvalidCastException] {" [A]MyLib.SomeAccount cannot be cast to [B]MyLib.SomeAccount. Type A originates from in the context 'Default' at location 'Y:\\MySrcCode\\FolderA\\Debug\\MyAcct.dll'. Type B originates from 'MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'Y:\\MySrcCode\\FolderB\\Debug\\MyAcct.dll'."} System.InvalidCastException Note, class exactly the same... but folder different ... how to resolve...? This may be hint but...[^] Another hint here[^]

    C# csharp wpf wcf com debugging

  • Why does it take so long?
    1 1eyhk1

    "In fact I became a programmer BECAUSE IT IS GOD DAMN SIMPLE/EASY"

    The Lounge question business

  • Why does it take so long?
    1 1eyhk1

    Don't you hate it when clients/users ask "Why does it takes so long?" I mean, what's complicated in the development of enterprise app? In fact, it's nothing rocket science. And tech business has been known for its simplicity!

    The Lounge question business

  • WCF knowntypes
    1 1eyhk1

    Curious - for simple array such as string[], if I declare known type from interface, they just won't show on object browser (but other custom/non-System types developed in-house can), thus the infamous: There was an error while trying to serialize parameter http://CalcProcessWCF:req. The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details. I have to resort to set it programmatically from proxy in order to get it working: foreach (var operation in proxy.Endpoint.Contract.Operations) { operation.KnownTypes.Add(typeof(MyDynamicallyAddedKnownType)); } why...

    C# csharp wcf com data-structures json

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    Many thanks Master Cao! If I still can't get my WCF contract working I may just try serialize/de-serialize whole deal to byte[]

    C# tutorial question learning

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    Hello Gonzalo Do you have the code for reverse process as well please please please?

    C# tutorial question learning

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    Many thanks I don't have time test it now but already feel my knowledge increase

    C# tutorial question learning

  • WCF host instant and open programmatically - how to relate to binding in app.config?
    1 1eyhk1

    hello For WCF host instantiated and opened programmatically - how to relate to binding in app.config? For example, here we get the channel open: using (ServiceHost host = new ServiceHost(typeof(GridControllerService))) { System.ServiceModel.WSDualHttpBinding binding = new WSDualHttpBinding(); binding.OpenTimeout = new TimeSpan(3, 0, 0); binding.CloseTimeout = new TimeSpan(3, 0, 0); binding.SendTimeout = new TimeSpan(3, 0, 0); binding.ReceiveTimeout = new TimeSpan(3, 0, 0); binding.MaxBufferPoolSize = 5000; host.AddServiceEndpoint(typeof(IGridControllerService), binding, "wsDualHttpBinding"); host.Open(); But instead of programmatically code up the binding config, we code have relate it to what's already in app.config <system.serviceModel> <bindings> <wsDualHttpBinding> <binding name="SomeHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" .... In this case, how can I relate "host" instantiated programmatically (yes weird why not do the whole deal in config right? But that's not my question) to "SomeHttpBinding" in config file. Thanks

    C# question wcf tutorial csharp wpf

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    1 1eyhk1

    hello How to convert any object to byte[] without marking it Serializable or DataContract? Of course this would work but you'd need to mark myObj class Serializable (I'm lazy dont want handcode serializable for big classes sorry) using (System.IO.MemoryStream returnStm = new System.IO.MemoryStream()) { BinaryFormatter ftm = new BinaryFormatter(); ftm.Serialize(returnStm , myObj); return returnStm .ToArray(); // this would return byte[] } Anyone who can tell me how I can commit such crime? Thank you

    C# tutorial question learning

  • Visa/Mastercard integration
    1 1eyhk1

    hello Is it a big job to integrate a ecommerce site with Visa/Mastercard, in comparison to say Paypal? What needs to be done (setup merchant account?) before I can even start test with their API's (Ftp? Web Service? Http based? What's it like? Can we get doc on API before even sign up, is it publicly available)? Thank you

    The Lounge json question career workspace
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups