Select to view content in your preferred language

esriLicenseProductCodeArcServer cannot be licensed in web service

4000
10
Jump to solution
11-24-2012 07:40 PM
XintaoLiu
Deactivated User
I created a web service that makes connecting to the geodatabase.

When I debug the code of the web service (C# VS2010), the binding is false and the licenseStatus is "esriLicenseNotLicensed". I believe that the settings are correct (please see attached picture). The operating system is Windows 7 in 64-bit, and my ArcGIS version is 10.1. Thanks.

bool bBinding = ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Server);
IAoInitialize m_AOInit = new AoInitializeClass();
esriLicenseStatus licenseStatus = m_AOInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer);

[ATTACH=CONFIG]19504[/ATTACH]
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
XintaoLiu
Deactivated User
Finally I installed ArcGIS 10.0 on our web server and then published the web service successfully! I just don't what the difference between version 10.0 and 10.1, but the latter one just does not work in web service.

View solution in original post

0 Kudos
10 Replies
RichardWatson
Deactivated User
On the installation media there is a utility called PatchFinder.  Run that and post the dialog displayed.
0 Kudos
XintaoLiu
Deactivated User
On the installation media there is a utility called PatchFinder.  Run that and post the dialog displayed.


Thanks for your reply! Below is the dialog when I run PatchFinder. And the PatchFinder is downloaded from here: http://support.esri.com/en/downloads/patches-servicepacks/view/productid/67/metaid/1927#install

[ATTACH=CONFIG]19508[/ATTACH]

However, when I change the initialization code as follows, the binding becomes True and licenseStatus is "esriLicenseCheckedOut". Then I can use any ArcObjects and connect to SDE Oracle. But, when I publish ths web service to server IIS, it cannot be accessed. Many thanks in advance!

bool bBinding = ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
IAoInitialize m_AOInit = new AoInitializeClass();
esriLicenseStatus licenseStatus = m_AOInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeStandard);
[ATTACH=CONFIG]19509[/ATTACH]
0 Kudos
RichardWatson
Deactivated User
My guess is that the problem is that you have IIS configured to run in 32 bits.

It should be simple to modify your service to log a message to a file on startup.  The message should simply say whether or not the host process is 64 bit.  Here is the code that you need to do that:

var isSixtyFourBit = IntPtr.Size == 8;

Processes are either 32 bit or 64 bit and you cannot load a 32 bit DLL in a 64 bit host process nor can you load a 64 bit DLL in a 32 host process.  ArcGIS Server is 64 bit which means that the host process must be 64 bit.  Desktop is 32 bit which means that the host process must be 32 bit.

In the case of IIS, it is IIS configuration which determines whether the host process is 32 or 64 bit.
0 Kudos
XintaoLiu
Deactivated User
My guess is that the problem is that you have IIS configured to run in 32 bits.

It should be simple to modify your service to log a message to a file on startup.  The message should simply say whether or not the host process is 64 bit.  Here is the code that you need to do that:

var isSixtyFourBit = IntPtr.Size == 8;

Processes are either 32 bit or 64 bit and you cannot load a 32 bit DLL in a 64 bit host process nor can you load a 64 bit DLL in a 32 host process.  ArcGIS Server is 64 bit which means that the host process must be 64 bit.  Desktop is 32 bit which means that the host process must be 32 bit.

In the case of IIS, it is IIS configuration which determines whether the host process is 32 or 64 bit.


Thanks a lot for your reply! I appreciate that!

I tried the code and isSixtyFourBit is False, which means it is 32 bit DLL. As you can see the settings of my C# project and IIS, it is all allowed to run 32 bit DLL. My problem is: in debug mode, all the codes are running smoothly, but when I publish it to IIS, only the AoInitialization code cannot work, which leads to the web service cannot work.

I doubt that whether it is because the ArcGIS license server is on another computer, which cannot be accessed via IIS, but can be accessed in local debug mode? Plus, to use AO and connect SDE in a web service, the following AoInitialization code is enough?
bool bBinding = ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
IAoInitialize m_AOInit = new AoInitializeClass();
esriLicenseStatus licenseStatus = m_AOInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);

Thank you again.
0 Kudos
RichardWatson
Deactivated User
Set your C# project properties to build x64.
0 Kudos
XintaoLiu
Deactivated User
Set your C# project properties to build x64.


Thanks for your patience! I set my C# project properties to build x64, and then tried to debug it. The below errors occurred: "Could not load file or assembly 'canIceService' or one of its dependencies. An attempt was made to load a program with an incorrect format."
0 Kudos
XintaoLiu
Deactivated User
Thanks for your patience! I set my C# project properties to build x64, and then tried to debug it. The below errors occurred: "Could not load file or assembly 'canIceService' or one of its dependencies. An attempt was made to load a program with an incorrect format."


Attached is my testing C# project, which is good in debug mode, but cannot be published to IIS. If I remove this line "m_AOInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);", then this web service can be published, but cannot connect to SDE.

Thank you so much.
0 Kudos
XintaoLiu
Deactivated User
Finally I installed ArcGIS 10.0 on our web server and then published the web service successfully! I just don't what the difference between version 10.0 and 10.1, but the latter one just does not work in web service.
0 Kudos
SamuelPienaar
Emerging Contributor
Good day.
I have a similar problem where a web service published using ArcObjects from the ArcGIS 10 SDK worked fine. It was a web service that called some Business Logic to clip a feature class using the geoprocessor. Now we are migrating to ArcGIS 10.1 and the web service does not want to excuate any geoprocessing task. The moment I call gp.Execute it fails. I then tried to rather use the ArcGIS Server dlls and check out the ArcGIS Server License instead of the ArcGIS Desktop License. That part worked fine. But the moment I try to add other ArcGIS Server dlls in Visual Studio I get the following.
[ATTACH=CONFIG]21826[/ATTACH]

Now ArcGIS Server 10.1 SP1 and ArcGIS Desktop 10.1 sp1 is installed on my machine and I can add any Destop or Egine Dlls to my web service but the Server option is greyed out? Why is this and how do I fix this? As mentioned before all of this worked fine in ArcGIS 10. I did change the web service to run in any CPU as I know ArcGIS Server is 64 bit. Im also using the .NET Framework 4 all though I have tried 3.5 without any success. I'm really stuck at this point and do need some help.
0 Kudos