c# - WCF + Singleton + File transfer + Multithreading -


i have file transfer service written using wcf. recieves file sent client. client inturn sends across file using filestream + messagecontract. have made wcf file transfer service singleton using following attributes

[servicebehavior(instancecontextmode = instancecontextmode.single,  concurrencymode = concurrencymode.multiple)] 

i try use multiple threads in client itself. each thread creates instance of channelfactory + proxy.createchannel , sends across 1 distinct file service. not have locks on service side allows 1 file transferred @ time, nor on client side. code kind of pass through code no state persistance.

the problem facing is, such not see multiple threads trying send multiple files. each time try transfer multiple files using multiple threads, service kind of not accept multiple files @ same instance. results in file getting transferred sequentially instead of in parallel. feel client side file sent @ service side kind of gets held up.

i tried using servicethrottling attributes, still not find difference. there wrong doing or kind of approach not valid?

one client can send 1 file across 1 channel? can many threads not send many files same service ? can please me.

thanks sandeep

i hate admit silly mistakes have encountered during series, admit, how silly was.

  1. reason single thread execution. had put lock right away @ beginning of service entry, 1 thread allowed while rest waited.

  2. reason couple of threads getting executed instead of many. since bandwidth 2mbps, , trying transfer 10 files each of 10mb, assuming network getting choked. when try 10 files each of 100kb multithreading works charm able control inlet of threads using maxconcurrentcalls.

cheers, everyone, , yk1

btw. in case wrong, please correct assumption network bandwidth being culprit.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -