<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 502 (Bad Gateway) and Http clients</title>
	<atom:link href="http://kennyw.com/work/indigo/54/feed" rel="self" type="application/rss+xml" />
	<link>http://kennyw.com/work/indigo/54</link>
	<description>Kenny Wolf</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:21:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: BizTalk, WCF and the Bad Gateway &#171; Santosh Benjamin&#8217;s Weblog</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-188001</link>
		<dc:creator>BizTalk, WCF and the Bad Gateway &#171; Santosh Benjamin&#8217;s Weblog</dc:creator>
		<pubDate>Sat, 28 Nov 2009 16:52:38 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-188001</guid>
		<description>[...] buried deep in the bindings that caused us the grief. After sorting this out I stumbled across this post from Kenny Wolf  which points to the offending setting. Wish I had found that earlier, but then I wouldnt have [...]</description>
		<content:encoded><![CDATA[<p>[...] buried deep in the bindings that caused us the grief. After sorting this out I stumbled across this post from Kenny Wolf  which points to the offending setting. Wish I had found that earlier, but then I wouldnt have [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenny</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-34651</link>
		<dc:creator>Kenny</dc:creator>
		<pubDate>Fri, 09 Mar 2007 02:11:40 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-34651</guid>
		<description>What account are each of these applications running as? It sounds like the domain account for the windows service does not have the correct proxy settings</description>
		<content:encoded><![CDATA[<p>What account are each of these applications running as? It sounds like the domain account for the windows service does not have the correct proxy settings</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harvinder Bholowasia</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-32081</link>
		<dc:creator>Harvinder Bholowasia</dc:creator>
		<pubDate>Sat, 24 Feb 2007 11:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-32081</guid>
		<description>I am trying to get the Metadata of a service using MetadataExchangeClient, from a Self-Hosted (Windows Service) WCF service. I am getting the following error:-
System.InvalidOperationException was caught
  Message=&quot;Metadata contains a reference that cannot be resolved: &#039;http://harvinder-test.csfidc.com/Session40/SessionManagerAdmin.svc?xsd=xsd1&#039;.&quot;
  Source=&quot;System.ServiceModel&quot;
  StackTrace:
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode)
       at Microsoft.ConnectedServices.MV.DebugService.SessionChannelFactory._getKerberosEndpoint(String server) in C:\MVInstall\Local\src\MVServer\Microsoft.ConnectedServices.MV.DebugService\SessionChannelFactory.cs:line 107

                The inner-exception is The remote server returned an error: (502) Bad Gateway. 

                The code that I used to get the Metadata is:-
        private static ServiceEndpoint _getKerberosEndpoint(string server)
        {
            string ssuffix = System.Configuration.ConfigurationManager.AppSettings[&quot;SessionManagerAdminAddressSuffix&quot;];
            WSHttpBinding mexBinding = new WSHttpBinding(SecurityMode.None);
            mexBinding.MaxReceivedMessageSize = Int32.MaxValue;
            MetadataExchangeClient mexClient = new MetadataExchangeClient(mexBinding);
            mexClient.ResolveMetadataReferences = true;
            MetadataSet metadataSet = null;
            WsdlImporter importer = null;
            ServiceEndpoint endpointToReturn = null;

            //Get the ISessionMgrAdmin Metadata
            Uri wsdlUri = new Uri(&quot;http://&quot; + server + &quot;/&quot; + ssuffix + &quot;?wsdl&quot;);
            metadataSet = mexClient.GetMetadata(wsdlUri, MetadataExchangeClientMode.HttpGet);
            importer = new WsdlImporter(metadataSet);
            ServiceEndpointCollection secCollection = importer.ImportAllEndpoints();

            WSHttpBinding currentBinding = null;
            foreach (ServiceEndpoint ep in secCollection)
            {
                currentBinding = ep.Binding as WSHttpBinding;
                if (currentBinding == null &#124;&#124; currentBinding.Security.Message.ClientCredentialType != MessageCredentialType.Windows)
                    continue;
                endpointToReturn = ep;
                break;
            }

            return endpointToReturn;
        }

                But when I try to get the Metadata of the same service, using a ConsoleApplication (using the same piece of code, as in the Windows Service) â€“ I am able to retrieve the ServiceEndpoint correctly!!
                Can someone please tell me what might be going wrong?</description>
		<content:encoded><![CDATA[<p>I am trying to get the Metadata of a service using MetadataExchangeClient, from a Self-Hosted (Windows Service) WCF service. I am getting the following error:-<br />
System.InvalidOperationException was caught<br />
  Message=&#8221;Metadata contains a reference that cannot be resolved: &#8216;http://harvinder-test.csfidc.com/Session40/SessionManagerAdmin.svc?xsd=xsd1&#8242;.&#8221;<br />
  Source=&#8221;System.ServiceModel&#8221;<br />
  StackTrace:<br />
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)<br />
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)<br />
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)<br />
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)<br />
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode)<br />
       at Microsoft.ConnectedServices.MV.DebugService.SessionChannelFactory._getKerberosEndpoint(String server) in C:\MVInstall\Local\src\MVServer\Microsoft.ConnectedServices.MV.DebugService\SessionChannelFactory.cs:line 107</p>
<p>                The inner-exception is The remote server returned an error: (502) Bad Gateway. </p>
<p>                The code that I used to get the Metadata is:-<br />
        private static ServiceEndpoint _getKerberosEndpoint(string server)<br />
        {<br />
            string ssuffix = System.Configuration.ConfigurationManager.AppSettings["SessionManagerAdminAddressSuffix"];<br />
            WSHttpBinding mexBinding = new WSHttpBinding(SecurityMode.None);<br />
            mexBinding.MaxReceivedMessageSize = Int32.MaxValue;<br />
            MetadataExchangeClient mexClient = new MetadataExchangeClient(mexBinding);<br />
            mexClient.ResolveMetadataReferences = true;<br />
            MetadataSet metadataSet = null;<br />
            WsdlImporter importer = null;<br />
            ServiceEndpoint endpointToReturn = null;</p>
<p>            //Get the ISessionMgrAdmin Metadata<br />
            Uri wsdlUri = new Uri(&#8220;http://&#8221; + server + &#8220;/&#8221; + ssuffix + &#8220;?wsdl&#8221;);<br />
            metadataSet = mexClient.GetMetadata(wsdlUri, MetadataExchangeClientMode.HttpGet);<br />
            importer = new WsdlImporter(metadataSet);<br />
            ServiceEndpointCollection secCollection = importer.ImportAllEndpoints();</p>
<p>            WSHttpBinding currentBinding = null;<br />
            foreach (ServiceEndpoint ep in secCollection)<br />
            {<br />
                currentBinding = ep.Binding as WSHttpBinding;<br />
                if (currentBinding == null || currentBinding.Security.Message.ClientCredentialType != MessageCredentialType.Windows)<br />
                    continue;<br />
                endpointToReturn = ep;<br />
                break;<br />
            }</p>
<p>            return endpointToReturn;<br />
        }</p>
<p>                But when I try to get the Metadata of the same service, using a ConsoleApplication (using the same piece of code, as in the Windows Service) â€“ I am able to retrieve the ServiceEndpoint correctly!!<br />
                Can someone please tell me what might be going wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mattonsoftware.com : .NET Resources</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-1073</link>
		<dc:creator>mattonsoftware.com : .NET Resources</dc:creator>
		<pubDate>Sat, 06 May 2006 08:33:34 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-1073</guid>
		<description>[...]  [...]</description>
		<content:encoded><![CDATA[<p>[...]  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kennyw.com &#187; Blog Archive &#187; Configuration Http Proxies in WCF</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-691</link>
		<dc:creator>kennyw.com &#187; Blog Archive &#187; Configuration Http Proxies in WCF</dc:creator>
		<pubDate>Thu, 20 Apr 2006 23:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-691</guid>
		<description>[...] When using Http, proxy configuration madness is a fact of life. If misconfigured, you can wind up trying to decipher obtuse 502 (Bad Gateway) and 504 (Gateway Timeout) errors. [...]</description>
		<content:encoded><![CDATA[<p>[...] When using Http, proxy configuration madness is a fact of life. If misconfigured, you can wind up trying to decipher obtuse 502 (Bad Gateway) and 504 (Gateway Timeout) errors. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hao Xu</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-50</link>
		<dc:creator>Hao Xu</dc:creator>
		<pubDate>Tue, 25 Oct 2005 22:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-50</guid>
		<description>502 can also be due to the firewall if the server is running on the same machine. If the on-machine server is listening at a port blocked by the firewall, the proxy server won&#039;t be able to connect. It will ultimately time out after several failed TCP SYN packets and return 502 to client.</description>
		<content:encoded><![CDATA[<p>502 can also be due to the firewall if the server is running on the same machine. If the on-machine server is listening at a port blocked by the firewall, the proxy server won&#8217;t be able to connect. It will ultimately time out after several failed TCP SYN packets and return 502 to client.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yasser Shohoud</title>
		<link>http://kennyw.com/work/indigo/54/comment-page-1#comment-48</link>
		<dc:creator>Yasser Shohoud</dc:creator>
		<pubDate>Wed, 12 Oct 2005 17:43:13 +0000</pubDate>
		<guid isPermaLink="false">http://kennyw.com/indigo/54#comment-48</guid>
		<description>&lt;strong&gt;Meet the WCF Channel Model - Part 1&lt;/strong&gt;

For the past 5 months or so, Iâ€™ve been working on the WCF Core Communications team (with Kenny, Matt,...</description>
		<content:encoded><![CDATA[<p><strong>Meet the WCF Channel Model &#8211; Part 1</strong></p>
<p>For the past 5 months or so, Iâ€™ve been working on the WCF Core Communications team (with Kenny, Matt,&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

