{"id":709,"date":"2012-09-12T14:18:20","date_gmt":"2012-09-12T13:18:20","guid":{"rendered":"http:\/\/blog.repsaj.nl\/?p=709"},"modified":"2012-09-12T14:18:20","modified_gmt":"2012-09-12T13:18:20","slug":"sp2013-proxy-problems-with-sharepoint-2013-apps","status":"publish","type":"post","link":"http:\/\/blog.repsaj.nl\/index.php\/2012\/09\/sp2013-proxy-problems-with-sharepoint-2013-apps\/","title":{"rendered":"SP2013: Proxy problems with SharePoint 2013 apps"},"content":{"rendered":"<p>Ok, a bit sooner as I had expected; but here&#8217;s my first tech post on SharePoint 2013.<\/p>\n<p>I was trying out some of the examples found on MSDN for creating SharePoint 2013 apps, such as this one: <a href=\"http:\/\/code.msdn.microsoft.com\/SharePoint-2013-Hello-0fd15fbf\">http:\/\/code.msdn.microsoft.com\/SharePoint-2013-Hello-0fd15fbf<\/a>. I kept on running into several problems; beginning with the infamous &#8220;object reference not set to an instance of an object&#8221; nullreference exception. After some scooping around in the matching TokenHelper.cs file, I noticed it had something to do with setting up a connection to the access control service (ACS) at Microsoft.<\/p>\n<p><!--more--><\/p>\n<p>At my office, we&#8217;re behind a ISA firewall \/ proxy which handles incoming and outgoing data. I had a suspicion my problems could be caused by that. But normal internet traffic (IE, webradio, you name it) all works fine, so why wouldn&#8217;t this?<\/p>\n<p>I used Fiddler to see what was going on behind the scenes. And hey! It suddenly started working without any errors. Fiddler replaces the IE proxy settings with it&#8217;s own and if you have configured a proxy; it routes all traffic there after catching it. So now my requests were routed through Fiddler and then forwarded to the proxy.<\/p>\n<p>Our proxy is configured by a automatic configuration script. The &#8220;use a proxy server&#8221; textbox is empty. Fiddler uses this box though, bypassing the script. So I opened the script and found the proxy URL being used. I then insterted that into the &#8220;use a proxy server&#8221; textbox and there we go: no errors any more.<\/p>\n<p>If you don&#8217;t want to use that textbox (if you don&#8217;t want to switch it off when you come home each time for instance), you need to explicitely tell the app to use a proxy. You can do this by editing the web.config file and adding:<\/p>\n<pre class=\"prettyprint\">\r\n  &lt;system.net&gt;\r\n    &lt;defaultProxy useDefaultCredentials=\"true\"&gt;\r\n      &lt;proxy usesystemdefault=\"False\" proxyaddress=\"http:\/\/proxyaddress:8080\" bypassonlocal=\"False\" \/&gt;\r\n    &lt;\/defaultProxy&gt;\r\n  &lt;\/system.net&gt;\r\n<\/pre>\n<p><strong>Conclusion:<\/strong> when using an automatic proxy script, asp.net doesn&#8217;t discover your proxy correctly. Set the proxy details in web.config and you&#8217;re good to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ok, a bit sooner as I had expected; but here&#8217;s my first tech post on SharePoint 2013. I was trying out some of the examples found on MSDN for creating SharePoint 2013 apps, such as this one: http:\/\/code.msdn.microsoft.com\/SharePoint-2013-Hello-0fd15fbf. I kept on running into several problems; beginning with the infamous &#8220;object reference not set to an<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[34],"tags":[75,76,39,77],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3KFR1-br","_links":{"self":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/709"}],"collection":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/comments?post=709"}],"version-history":[{"count":0,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/709\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/media?parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/categories?post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/tags?post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}