ASP.Net Framework 4.0 WCF Concurrency -
ASP.Net Framework 4.0 WCF Concurrency -
i new wcf, facing concurrency related issue in hosted wcf service (.net framework 4.0) on iis 7 / windows 2008 server. did possibilities after googling still not able prepare problem. have created , inventory service uses entity framework fetch info sql server tables itemheadmaster
, itemmaster
etc.
i referenced wcf in custom user search command searching purposes. running when 2 concurrent user nail search command placed on asp.net page.
my code looks this:
namespace his.storeservices { [servicebehavior(concurrencymode=concurrencymode.multiple)] public class storemasterdata : istoremasterdata { public string getallitemhead(string strhospitalid) { using (dal.itemheadmaster objitemheadmasterdal = new dal.itemheadmaster()) { list<store.model.itemheadmaster> objitemheammasterlist = new list<store.model.itemheadmaster>(); objitemheammasterlist = objitemheadmasterdal.getallitemhead(strhospitalid); xmlserializer xml_serializer = new xmlserializer(objitemheammasterlist.gettype()); stringwriter author = new stringwriter(); xml_serializer.serialize(writer, objitemheammasterlist); homecoming writer.tostring(); } } }
i did next after googling:
added in config no effect
<system.net> <connectionmanagement> <add address="*" maxconnection="100" /> </connectionmanagement> </system.net>`
added in config no effect instead gets more slow..
<behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true" /> <servicethrottling maxconcurrentcalls="32" maxconcurrentinstances="2147483647" maxconcurrentsessions="20"/>
please help
before wcf, build service cross process communications between processes in same host, or in same lan, or in internet, have hand-craft transportation layers , info serializations target environments , specific protocols.
with wcf, need focus on creating info models (datacontracts after beingness decorated attributes) , operation models (operationcontracts), , .net clr "create" if not needed transportation layers , info serializations @ run time, according configuration defined or scheme administration in target environment.
the defects in codes:
wcf typically uses datacontractserializer, not xmlserializer serialize things, , don't need phone call explicitly, since runtime it. for applications, don't need servicebehaviorattribute explicitly. must know wcf in depth before using advantage config not beginner. , used them.your service interface function should comfortably homecoming complex type rather serialized text. in 99.9% of cases, if have explicit serialization codes in wcf programs, whole design dirty if not exclusively wrong.
there plenty of tutorials of creating hello world wcf projects, , vs has 1 when creating new wcf application. after got familiar hello world, may have @ http://www.codeproject.com/articles/627240/wcf-for-the-real-world-not-hello-world
btw, wcf serialization fast, check http://webandlife.blogspot.com.au/2014/05/performances-of-deep-cloning-and.html
wcf
Comments
Post a Comment