I have a javascript application that needs use security user to retrieve map service. If I just run my application in VS. It works well. But if I publish my application to IIS and run it,I find it doesn't work well. Can anyone provide a code example in javascript to get all the mapservices which use security user. Thanks in advance.
get token URL:http://myserver:port/arcgis/tokens?request=getToken&username=test&password=test&expiration=60
get services RUL:http://myserver:port/arcgis/rest/services/?f=pjson&token=token
1.Run in VS and it works well.

2.Publish to IIS. it does not works well.

I don't know why, can anyone help me? Thanks.