Retrieving Token Dynamically from secure REST service

724
4
08-04-2010 08:29 AM
PerryDonnafield
New Contributor
I have two load balanced servers running my mapping application and I am attempting to retrieve my tokens for a secure service dynamically. Any maps from non-secure services are retrieved just fine. However, when I try to retrieve maps from the secure service, I get a "The remote server returned an error: (500) Internal Server Error."

I am using a proxy to request the token and it fails on the following line when trying to get the token from the token service:

System.Net.WebResponse tokenResponse = tokenRequest.GetResponse();

I posted this here because I am using the JS API but need to post under REST API. I am going to stand up my app on a non load balanced server to see if that is the issue but that is not where it can run long term.

Any ideas??
0 Kudos
4 Replies
PerryDonnafield
New Contributor
Ok, so i stood up my app on a non-load balanced server and it is retrieving the token dynamically just fine and returning a image from the secure service.

Anybody have any thoughts as to what the issue may be with the load balanced scenario?
0 Kudos
AdamPfister
Esri Contributor
can you wrap the get response line in a try/catch to catch the webexception?  although it's returning 500, the web exception may have more information about what's really happening (404, 401, 407, etc.)
0 Kudos
PerryDonnafield
New Contributor
Thanks Adam, it is in a try/catch but I am just catching a general Exception and that is the error that is being thrown which is useless. I will catching a WebException first and see what I get.
0 Kudos
PerryDonnafield
New Contributor
Well, for now, this thing has started working. I didn't really do anything. It is retrieving the token just fine and getting the image from the service. Wish I knew what was going on.
0 Kudos