<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Enabling HTTPS programmatically in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617128#M23708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I installed Server 10.1 SP1 (with security patch) on a new Windows Server 2012 server.&amp;nbsp; My code checks the security configuration of ArcGIS Server and then changes it via a POST to &lt;/SPAN&gt;&lt;A href="http://localhost:6080/arcgis/admin/security/config/update"&gt;http://localhost:6080/arcgis/admin/security/config/update&lt;/A&gt;&lt;SPAN&gt; with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;securityEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;httpEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sslEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That succeeds.&amp;nbsp; The next thing I do is to try to POST to &lt;/SPAN&gt;&lt;A href="https://localhost:6443/arcgis/admin/security/config/updateIdentityStore"&gt;https://localhost:6443/arcgis/admin/security/config/updateIdentityStore&lt;/A&gt;&lt;SPAN&gt; but recieve the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Net.WebException: Unable to connect to the remote server&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:6443&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like there is some type of delay here before SSL is actually enabled.&amp;nbsp; After the error is recieved, SSL is enabled and it works fine.&amp;nbsp; I think&amp;nbsp; that the problem relates to timing.&amp;nbsp; Suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Dec 2012 12:54:03 GMT</pubDate>
    <dc:creator>RichardWatson</dc:creator>
    <dc:date>2012-12-12T12:54:03Z</dc:date>
    <item>
      <title>Enabling HTTPS programmatically</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617128#M23708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I installed Server 10.1 SP1 (with security patch) on a new Windows Server 2012 server.&amp;nbsp; My code checks the security configuration of ArcGIS Server and then changes it via a POST to &lt;/SPAN&gt;&lt;A href="http://localhost:6080/arcgis/admin/security/config/update"&gt;http://localhost:6080/arcgis/admin/security/config/update&lt;/A&gt;&lt;SPAN&gt; with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;securityEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;httpEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sslEnabled : true&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That succeeds.&amp;nbsp; The next thing I do is to try to POST to &lt;/SPAN&gt;&lt;A href="https://localhost:6443/arcgis/admin/security/config/updateIdentityStore"&gt;https://localhost:6443/arcgis/admin/security/config/updateIdentityStore&lt;/A&gt;&lt;SPAN&gt; but recieve the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Net.WebException: Unable to connect to the remote server&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:6443&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like there is some type of delay here before SSL is actually enabled.&amp;nbsp; After the error is recieved, SSL is enabled and it works fine.&amp;nbsp; I think&amp;nbsp; that the problem relates to timing.&amp;nbsp; Suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 12:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617128#M23708</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2012-12-12T12:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling HTTPS programmatically</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617129#M23709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Peraphs the origin delay: applying changes to the Protocol parameter will automatically re-start your ArcGIS Server site.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 13:24:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617129#M23709</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2012-12-12T13:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling HTTPS programmatically</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617130#M23710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think that that is probably true.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The thing that I am wondering is how to accomodate this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The obvious things to do are to add a sleep statement and/or a retry.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really hate programming this way.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 13:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617130#M23710</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2012-12-12T13:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling HTTPS programmatically</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617131#M23711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;but before call the second POST do you dispose the sockets?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 13:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617131#M23711</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2012-12-12T13:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Enabling HTTPS programmatically</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617132#M23712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think that I understand what is going on here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you enable SSL, the server recycles itself.&amp;nbsp; When, and if, the calls returns from enabling SSL; I followup by making another call.&amp;nbsp; Subsequent calls will continue to fail until the server is functional again.&amp;nbsp; I simply put this in a loop and try a certain number of times before giving up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are 2 obtuse problems here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first problem is that I believe there is a bug in ArcGIS Sever where it recycles before it returns a response from the call which enables SSL.&amp;nbsp; In my case I have a single machine (i.e. localhost).&amp;nbsp; You can easily see this by using the ArcGIS Server Administrator Directory and performing an update on security to enable HTTP and HTTPS.&amp;nbsp; Try turning it on and off (HTTP only) several times.&amp;nbsp; What you will see is that sometimes the browser hangs when enabling HTTPS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The underlying code for this is in the SSLManager class.&amp;nbsp; See enableSSLLocal and restartServersLocal in package com.esri.arcgis.discovery.admin which is in arcgis-admin.jar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I do this in code then my code hangs waiting for a response.&amp;nbsp; The only workaround I see is to try to add timeout logic in my call to enable security.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The other problem, which is not an ArcGIS Server bug, is that the token I generated previously becomes invalid because the client ID changes when I subsequently use SSL.&amp;nbsp; So, what I do is to generate a new token after enabling SSL.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Dec 2012 11:06:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/enabling-https-programmatically/m-p/617132#M23712</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2012-12-13T11:06:16Z</dc:date>
    </item>
  </channel>
</rss>

