{"id":1168,"date":"2007-06-22T13:48:00","date_gmt":"2007-06-22T18:48:00","guid":{"rendered":"http:\/\/blogs.devhorizon.com\/reza\/?p=1168"},"modified":"2007-06-22T13:48:00","modified_gmt":"2007-06-22T18:48:00","slug":"follow-up-on-my-presentation-in-tspug-20june2007","status":"publish","type":"post","link":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/","title":{"rendered":"Follow up on my presentation in TSPUG (20\/June\/2007)"},"content":{"rendered":"<p><P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">1) For PDF version of the slides click <A href=\"\/downloads\/TopTips.pdf\">here<\/A>. <\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">2) All the code snippets are zipped into a file which can be downloaded from <A href=\"\/downloads\/TSPUG20062007Code.rar\">here<\/A>.<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">3) Follow up on questions which were not answered:<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><B style=\"mso-bidi-font-weight: normal\">Question 1)<\/B><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp; <\/SPAN>A gentleman mentioned that they are getting <B style=\"mso-bidi-font-weight: normal\">&#8220;The underlying connection was closed&#8230;&#8221; <\/B>after a while when they call a sharePoint web service. I asked him to follow up on this with me later on , but it seems that our guy is so busy so I went ahead and replicated the same problem on my end.As I mentioned in the session too, this behavior can occur for a number of reasons. From not having access to call the web service to not having the proper ACL on the asmx file itself. Fortunately, his problem is more specific because he can call the web service for a while and then it fails so it clearly shows that it is not an access issue. I could replicate the issue when I called the web service from a windows form application which was behind a http proxy server. If I call the same web service not through the HTTP Proxy, the call goes through with no problem and it will stay alive forever &#8211; I tested my call the day after and service was still alive. When calling without using the HTTP Proxy, Web service is fine for the first few hours\/calls and then it dies and returns the same error message they are getting. Here is my 2 cents on this. I hope this helps:<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">I solved this issue&nbsp;by altering the generated proxy class. In that generated proxy class there is a method called &#8220;GetWebRequest&#8221; with the following signature:<\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><B style=\"mso-bidi-font-weight: normal\">&nbsp;&nbsp;&nbsp;protected override System.Net.WebRequest GetWebRequest(Uri uri)<\/B><\/P><\/BLOCKQUOTE><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">Change this method to:<\/P><br \/>\n<BLOCKQUOTE dir=ltr style=\"MARGIN-RIGHT: 0px\"><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">protected override System.Net.WebRequest GetWebRequest(Uri uri)<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">{<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp; &nbsp;<\/SPAN>System.Net.HttpWebRequest webRequest =<SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp; <\/SPAN>(System.Net.HttpWebRequest) base.GetWebRequest(uri);<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp;&nbsp; <\/SPAN>webRequest.KeepAlive = false;<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><SPAN style=\"mso-spacerun: yes\">&nbsp;&nbsp;&nbsp; <\/SPAN>return webRequest;<\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">}<\/P><\/BLOCKQUOTE><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\">Setting KeepAlive to false may result in sending a &#8220;Connection:Close&#8221; header to the server each time you initiate<SPAN style=\"mso-spacerun: yes\">&nbsp; <\/SPAN>the call and I believe that more processing is required on the server, so think twice before sticking to this solution. If you are okay with this performance hit that you may experience then go for it. <\/P><br \/>\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm 10pt\"><B style=\"mso-bidi-font-weight: normal\">Question 2)<\/B> Second question was made by one my colleagues about <B style=\"mso-bidi-font-weight: normal\">UpdateSystem<\/B> method.<A href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.sharepoint.splistitem.systemupdate.aspx\">SDK<\/A> clearly states that this method is a kind of silent\/anonymous update without leaving any foot trail behind. I can see many places that using this method is proffered over ordinary &#8220;Update()&#8221;. One of them is when you run a process to adjust some fields in the items of a list and you don&#8217;t want the \u201cmodified by\u201d and \u201cmodified date\u201d to be changed to your process account and the date and time the adjustment was made or even you don\u2019t want to release another version if versioning is in place. That was an interesting one and managed to be added to my top tips for writing better code in sharePoint \ud83d\ude42<\/P><br \/>\n<HR align=left width=\"50%\" noShade SIZE=10><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1) For PDF version of the slides click here. 2) All the code snippets are zipped into a file which can be downloaded from here. 3) Follow up on questions which were not answered: Question 1)&nbsp;&nbsp; A gentleman mentioned that they are getting &#8220;The underlying connection was closed&#8230;&#8221; after a while when they call a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1168","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Follow up on my presentation in TSPUG (20\/June\/2007) - Reza Alirezaei&#039;s Blog %<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Reza Alirezaei\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/\"},\"author\":{\"name\":\"Reza Alirezaei\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\"},\"headline\":\"Follow up on my presentation in TSPUG (20\\\/June\\\/2007)\",\"datePublished\":\"2007-06-22T18:48:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/\"},\"wordCount\":523,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/\",\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/\",\"name\":\"Follow up on my presentation in TSPUG (20\\\/June\\\/2007) - Reza Alirezaei's Blog %\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#website\"},\"datePublished\":\"2007-06-22T18:48:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/2007\\\/06\\\/22\\\/follow-up-on-my-presentation-in-tspug-20june2007\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#website\",\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/\",\"name\":\"Reza Alirezaei's Blog\",\"description\":\"Blogging from the field!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/#\\\/schema\\\/person\\\/cdbb24d283697a65951cb4a14e474938\",\"name\":\"Reza Alirezaei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g\",\"caption\":\"Reza Alirezaei\"},\"url\":\"https:\\\/\\\/blogs.devhorizon.com\\\/reza\\\/author\\\/rezaa\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Follow up on my presentation in TSPUG (20\/June\/2007) - Reza Alirezaei's Blog %","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/","twitter_misc":{"Written by":"Reza Alirezaei","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/#article","isPartOf":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/"},"author":{"name":"Reza Alirezaei","@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938"},"headline":"Follow up on my presentation in TSPUG (20\/June\/2007)","datePublished":"2007-06-22T18:48:00+00:00","mainEntityOfPage":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/"},"wordCount":523,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/","url":"https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/","name":"Follow up on my presentation in TSPUG (20\/June\/2007) - Reza Alirezaei's Blog %","isPartOf":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/#website"},"datePublished":"2007-06-22T18:48:00+00:00","author":{"@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blogs.devhorizon.com\/reza\/2007\/06\/22\/follow-up-on-my-presentation-in-tspug-20june2007\/"]}]},{"@type":"WebSite","@id":"https:\/\/blogs.devhorizon.com\/reza\/#website","url":"https:\/\/blogs.devhorizon.com\/reza\/","name":"Reza Alirezaei's Blog","description":"Blogging from the field!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blogs.devhorizon.com\/reza\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blogs.devhorizon.com\/reza\/#\/schema\/person\/cdbb24d283697a65951cb4a14e474938","name":"Reza Alirezaei","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3ba940d84e0ecb909e62e93df4c56daf0395c7e53c914467ab2ee73124a7d7b6?s=96&d=mm&r=g","caption":"Reza Alirezaei"},"url":"https:\/\/blogs.devhorizon.com\/reza\/author\/rezaa\/"}]}},"_links":{"self":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/1168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/comments?post=1168"}],"version-history":[{"count":0,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.devhorizon.com\/reza\/wp-json\/wp\/v2\/tags?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}