c# - WCF: How do I add a ServiceThrottlingBehavior to a WCF Service? -
I have a code to return an example of the WCF service ServiceClient :
var readerQuotas = new XmlDictionaryReaderQuotas () {MaxDepth = 6000000, MaxStringContentLength = 6000000, MaxArrayLength = 6000000, MaxBytesPerRead = 6000000, MaxNameTableCharCount = 6000000}; Var throttlingBehaviour = new service trophyfighter () {Max Convert Call = 500, MaxConcartInstance = 500, MaxConferenceSessions = 500}; Binding = New WSHttpBinding (SecurityMode.None) {MaxArequed Message Messaging = 6000000, ReaderQuota = ReaderQuotas}; DualBinding = New WSDualHttpBinding (WSDualHttpSecurityMode.None) {MaxReceivedMessageSize = 6000000, ReaderQuotas = readerQuotas}; End point = new endpoint ("http: // localhost: 28666 / dbnteraction gateway svc"); New MusicRepo_DBAccess_ServiceClient (new instance context (example context), dual binding, endpoint return return); Recently I was having some trouble with the timeout and so I decided to add the throttling behavior, such as: var throttlingBehaviour = newTeTTottlingBehavior () {Makskencrnt calls = 500, Makssnrrnt Instens = 500, Max Concentrations = 500};
My question is, where I throttling Behayr in the above code should add to my MusicRepo_DBAccess_ServiceClient example?
With some examples found on the web, they are doing something like this:
Service Host Host = New Service Host (Typf (MySwir)) ; Sewapratirkshnbavik Throtlbravier = new Sewatroftingviwahkrta (Makskencrnt call = 40, Makskencrintstens = 20, Makskencrentsshans = 20,}; host.Description.Behaviors.Add (throttleBehavior); host.Open (); Note That they are using a ServiceHost in the above code, while I am not, and then they are opening it ( open () ), while I Open the example MusicRepo_DBAccess_ServiceClient ... and it got me confused.
& lt; service Wyvharasnvedn = "Throttle this" / & gt; & LT; serviceBehaviors & gt; & Lt; behavior name = "Throttle this" & gt; & Lt; serviceMetadata httpGetEnabled = "True" / & gt; & Lt; Sewapratishtapan Adiktmkankrtcol = " 40 "Makscontrentinstens =" 20 "Makssnvritt session =" 20 "/ & gt; & Lt; / behavior & gt; & Lt; / serviceBehaviors & gt;
Comments
Post a Comment