<?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 Re: ArcObjects SDK .NET license initialization in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038467#M29752</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous User&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;It's possible. Try building the project with either *64bit platform or AnyCPU with "Prefer 32-bit" unchecked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HanhanSun1_0-1616103951264.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8843i79261A1C2D462A57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HanhanSun1_0-1616103951264.png" alt="HanhanSun1_0-1616103951264.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the project is built properly, the code should be able to bind server license (Bind(ProductCode.Server)) and checkout server license (Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer)).&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks a lot for the reply, actually this is what I'm expecting. I will try with different compilation strategies to see what happens.&lt;/P&gt;&lt;P&gt;Something that it's not clear to me is that AFAIK ArcObjects .NET is 32bit, at least on my dev env (I already tried sone experiments and I receive BadImageFormatException when trying to open a shapefile from a 64bit process), so maybe there's a 64 bit version I can use to develop the solution in my dev environment?&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 08:15:09 GMT</pubDate>
    <dc:creator>DiegoGuidi1</dc:creator>
    <dc:date>2021-03-19T08:15:09Z</dc:date>
    <item>
      <title>ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038130#M29741</link>
      <description>&lt;P&gt;Dear All, I'm trying to understand if it's possible to use code developed with ArcObjects SDK for .NET in an environment where only ArcGIS Enterprise (Server+Portal) is installed.&lt;/P&gt;&lt;P&gt;Basically I need to develop a task (as a windows service or as a scheduled task) that periodically extracts data from a geodatabase published by ArcGIS Enterprise.&lt;/P&gt;&lt;P&gt;I planned to use ArcObjects SDK for .NET, but the license initialization code that I'm using is working on my test environment (where ArcMap is installed) but not on the server environment (where ArcGIS Server and ArcGIS Portal are installed).&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;Below the code I'm using to check for the license:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;AoInitialize license = null;
try
{
	Console.WriteLine("License check started");
	var b = RuntimeManager.Bind(ProductCode.Server);
	// FAlSE ON BOTH ENVIRONMENTS: dev and produ
	Console.WriteLine($"RuntimeManager.Bind(ProductCode.Server): {b} =&amp;gt; {w.Elapsed}");
	if (!b)
	{
		// TRUE on dev env and FALSE on prod env
		b = RuntimeManager.Bind(ProductCode.Desktop);
		Console.WriteLine($"RuntimeManager.Bind(ProductCode.Desktop): {b} =&amp;gt; {w.Elapsed}");
	}
	if (!b)
	{
		// FALSE on prod env
		b = RuntimeManager.Bind(ProductCode.Engine);
		Console.WriteLine($"RuntimeManager.Bind(ProductCode.Engine): {b} =&amp;gt; {w.Elapsed}");
	}
	if (!b)
	{
		const string err = "RuntimeManager failed to bind to any product!";
		Console.WriteLine(err);
		return;
	}

	// code not run on production environment
	esriLicenseProductCode[] codes = new esriLicenseProductCode[]
	{
		esriLicenseProductCode.esriLicenseProductCodeArcServer,
		esriLicenseProductCode.esriLicenseProductCodeBasic,
		esriLicenseProductCode.esriLicenseProductCodeStandard, // detected on dev env
		esriLicenseProductCode.esriLicenseProductCodeAdvanced,
		esriLicenseProductCode.esriLicenseProductCodeEngine,
		esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB,
	};

	license = new AoInitialize();
	foreach (esriLicenseProductCode code in codes)
	{
		esriLicenseStatus status = license.IsProductCodeAvailable(code);
		if (status == esriLicenseStatus.esriLicenseAvailable)
		{
			Console.WriteLine($"Code '{code}' available... =&amp;gt; {w.Elapsed}");
			status = license.Initialize(code);
			if (status == esriLicenseStatus.esriLicenseAlreadyInitialized ||
				status == esriLicenseStatus.esriLicenseCheckedOut)
			{
				Console.WriteLine($"Code '{code}' initialized =&amp;gt; {w.Elapsed}");
				break;
			}
			else
			{
				Console.WriteLine($"Code '{code}' NOT initialized! =&amp;gt; {w.Elapsed}");
			}
		}
		else
		{
			Console.WriteLine($"Code '{code}' NOT available! =&amp;gt; {w.Elapsed}");
		}
	}
}
catch (Exception ex)
{
	Console.WriteLine($"Exception thrown &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; =&amp;gt; {w.Elapsed}");
	Console.WriteLine(ex);
}
finally
{
	license?.Shutdown();
	AOUninitialize.Shutdown();
	Console.WriteLine($"Shutdown completed =&amp;gt; {w.Elapsed}");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 15:54:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038130#M29741</guid>
      <dc:creator>DiegoGuidi1</dc:creator>
      <dc:date>2021-03-18T15:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038334#M29745</link>
      <description>&lt;P&gt;It's possible. Try building the project with either *64bit platform or AnyCPU with "Prefer 32-bit" unchecked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HanhanSun1_0-1616103951264.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8843i79261A1C2D462A57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HanhanSun1_0-1616103951264.png" alt="HanhanSun1_0-1616103951264.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the project is built properly, the code should be able to bind server license (Bind(ProductCode.Server)) and checkout server license (Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer)).&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 21:47:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038334#M29745</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-18T21:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038467#M29752</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous User&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;It's possible. Try building the project with either *64bit platform or AnyCPU with "Prefer 32-bit" unchecked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HanhanSun1_0-1616103951264.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8843i79261A1C2D462A57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HanhanSun1_0-1616103951264.png" alt="HanhanSun1_0-1616103951264.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the project is built properly, the code should be able to bind server license (Bind(ProductCode.Server)) and checkout server license (Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer)).&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks a lot for the reply, actually this is what I'm expecting. I will try with different compilation strategies to see what happens.&lt;/P&gt;&lt;P&gt;Something that it's not clear to me is that AFAIK ArcObjects .NET is 32bit, at least on my dev env (I already tried sone experiments and I receive BadImageFormatException when trying to open a shapefile from a 64bit process), so maybe there's a 64 bit version I can use to develop the solution in my dev environment?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 08:15:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1038467#M29752</guid>
      <dc:creator>DiegoGuidi1</dc:creator>
      <dc:date>2021-03-19T08:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039190#M29768</link>
      <description>&lt;P&gt;I actually tried but license checking code doesn't work with 64bit compilation&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 07:33:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039190#M29768</guid>
      <dc:creator>DiegoGuidi</dc:creator>
      <dc:date>2021-03-22T07:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039315#M29772</link>
      <description>&lt;P&gt;tested right now in a different environment (another dev environment) with arcobjects sdk 10.8.1 and it worked as you mentioned. in my standard dev environment I had arcobjects 10.5, but both are x64 environmetns with Win10 OS. So I suppose that the different behaviour depends of the SDK version...&lt;/P&gt;&lt;P&gt;anyway, thanks for the suggestion!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 15:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039315#M29772</guid>
      <dc:creator>DiegoGuidi</dc:creator>
      <dc:date>2021-03-22T15:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcObjects SDK .NET license initialization</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039337#M29774</link>
      <description>&lt;P&gt;just to add a bit of context, the suggested code works in 64bit mode, and my test code that failed in 64bit mode was related to the "ComReleaser" in the "ESRI.ArcGIS.ADF.Connection.Local" assembly, that probably isn't working on 64 bit. removing this reference, the arcobjects code that "do the actual work" (besides checking the license) works as expected.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 15:38:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/arcobjects-sdk-net-license-initialization/m-p/1039337#M29774</guid>
      <dc:creator>DiegoGuidi1</dc:creator>
      <dc:date>2021-03-22T15:38:09Z</dc:date>
    </item>
  </channel>
</rss>

