{"id":607,"date":"2013-07-22T15:42:33","date_gmt":"2013-07-22T15:42:33","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=607"},"modified":"2013-08-02T09:26:51","modified_gmt":"2013-08-02T09:26:51","slug":"void-return-methods-in-wcf-isoneway","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/void-return-methods-in-wcf-isoneway\/","title":{"rendered":"void return methods in WCF (IsOneWay)"},"content":{"rendered":"<p>Don&#8217;t forget, if you&#8217;re implementing a fire and forget style method call in WCF, to mark it as one way. <\/p>\n<p>In situations where you do not need or want to return a value from the server or handle exceptions from the client. You must mark the method&#8217;s operation contract as IsOneWay=true.<\/p>\n<p>For example (if this is the service contract)<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n&#x5B;ServiceContract]\r\npublic interface IProjectManager\r\n{\r\n   &#x5B;OperationContract(IsOneWay=true)]\r\n   void Run();\r\n}\r\n<\/pre>\n<p>Without the IsOneWay=true the method will get called by the client but will block and may  eventually timeout.<\/p>\n<p>Basically with a one way operation the client calls the service and the service may queue the call to be dispatched one at a time. If the number of queued calls exceeds the queue&#8217;s capacity the client will block. In the case of a one way call the message is queued but the client unblocked. It is not an async call but may appear that way.<\/p>\n<p>By default IsOneWay is false, hence the need to add the option to the attribute explicitly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Don&#8217;t forget, if you&#8217;re implementing a fire and forget style method call in WCF, to mark it as one way. In situations where you do not need or want to return a value from the server or handle exceptions from the client. You must mark the method&#8217;s operation contract as IsOneWay=true. For example (if this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-607","post","type-post","status-publish","format-standard","hentry","category-wcf"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=607"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":685,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/607\/revisions\/685"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}